On Sat, Sep 22, 2012 at 6:00 AM, Jim Ruther Nill <jvn...@gmail.com> wrote:
> reading from > http://guides.rubyonrails.org/association_basics.html#the-has_and_belongs_to_many-association > > The simplest rule of thumb is that you should set up a has_many :through > relationship if you need to work with the relationship model as an > independent entity. If you don’t need to do anything with the relationship > model, it may be simpler to set up a has_and_belongs_to_many relationship > (though you’ll need to remember to create the joining table in the > database). > > You should use has_many :through if you need validations, callbacks, or > extra attributes on the join model. Also, I haven't had to do it myself, but I've heard that retrofitting a habtm setup to use hmt, after discovering a need for any of the above, can be a royal pain in the proverbial posterior. So, I usually just ignore habtm, and use hmt for all such joins. -Dave -- Dave Aronson, Available Secret-Cleared Ruby/Rails Freelancer (VA/DC/Remote); see www.DaveAronson.com, www.Codosaur.us, and www.Dare2XL.com for more info. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.