Join Association Destroy

In the future will Active Record delete the child records in an
association when the parents are deleted? Certainly one can add code
in the controller or the database to take care of avoiding orphans but
it really seems like it should be part of the framework.

well… it is built in.

class User < ActiveRecord::Base
has_many :projects, :dependent => :destroy

See ActiveRecord::Associations docs for more.

Ahh thanks. There’s too much information in the api when you’re not
sure what you’re looking for.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs