[Rails] ActiveRecord on data integrity
Marcel Molina Jr.
marcel at vernix.org
Fri Nov 19 20:18:25 GMT 2004
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
--
Marcel Molina Jr. <marcel at vernix.org>
More information about the Rails
mailing list