Marnen Laibow-Koser wrote:
> Robert Walker wrote:
>> Jon Cox wrote:
>>> ooh found 'has_many_and_belongs_to' in ActiveRecord that takes care of 
>>> the match->match_game<-game relationship nicely!
>> 
>> The current trend in Rails is toward has_many :through instead of 
>> has_and_belongs_to_many (HABTM). 
> 
> Says who?  I tend to start with HABTM and refactor to has_many :through 
> if necessary.

Says, DHH in his initial promotion of the decision to move to a RESTful 
design. I did not, however, say that that this was right, just that it 
has been proposed by the person who developed the idea.

>> The has_many :trough is more flexible, 
>> and often more RESTful.
> 
> More flexible, yes.  But it's not the Simplest Thing That Could Possibly 
> Work [TM] in this case.

I concede this point.

> HABTM is a special simplified case.  If your data fits the special case, 
> it makes sense to take advantage of it.
> 
> As for REST, that's a routing issue, not an associations issue.

Again I concede. But, this was just a misuse of the terminology. I meant 
to say that having the joining model can lead to more RESTful routes in 
many cases. Again this was another point in DHH's initial talk on the 
move to REST. At that time, however, all this REST stuff was 
experimental. I'm sure we've learned a lot since that initial 
presentation on the subject matter.
-- 
Posted via http://www.ruby-forum.com/.
-- 
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.


Reply via email to