[Rails] ActiveRecord on data integrity
Marten Veldthuis
marten at standardbehaviour.com
Fri Nov 19 20:16:26 GMT 2004
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
--
Marten Veldthuis
More information about the Rails
mailing list