[Rails] ActiveRecord on data integrity

"Luis G. Gómez" lgomez at vfxnetwork.com
Fri Nov 19 20:21:31 GMT 2004


Great! Thankk you.

Marcel Molina Jr. wrote:
> On Fri, Nov 19, 2004 at 09:16:26PM +0100, Marten Veldthuis wrote:
> 
>>Luis G. G?mez wrote:
>>
>>>Say, if I had:
>>>
>>>class Project < ActiveRecord::Base
>>>  belongs_to :portfolio
>>>  has_one :project_manager
>>>  has_many :milestones
>>>  has_and_belongs_to_many :categories
>>>end
>>>
>>>...would AR errase a project's milestones if I errased the project that 
>>>owns them?
>>
>>It can, but you need to specify that milestones are dependent on the 
>>project:
>>
>>    has_many :milestones, :dependent => true
> 
> 
> The docs for association methods are here:
> http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html
> 
> marcel


More information about the Rails mailing list