|
There are two things I like about has_many :through. First, it
causes me to think about and try to name the relationship. Second,
it treats the join model as a first class entity, formalizing the
relationship - so i can say book.catalog_entries as well as
book.subjects. Form me, has_and_belongs_to_many obscures rather than reveals relationships so avoided it. My preference does not define general practice. So let's look at one authority. From The Rails 3 Way, section 7.5.1. That, too, is an opinion. But one probably more broadly founded than mine. As to a 'need' for CatalogEntry.... You need a join model. HABTM uses a join model. It just elides the fact. Is the devil's advocate satisfied? On 06/22/2011 01:31 PM, Tim Shaffer wrote: On Wednesday, June 22, 2011 1:21:06 PM UTC-4, gallivan wrote:I like has_many through with a CatalogEntry join model. -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. |
- [Rails] Best Models Associations suggestions rajeevkannav
- Re: [Rails] Best Models Associations suggestio... [email protected]
- Re: [Rails] Best Models Associations sugge... Tim Shaffer
- Re: [Rails] Best Models Associations s... [email protected]

