From: Logan Capaldo Date: 2006-08-16T13:10:12+09:00 Subject: Re: Dr Nic’s Magic Models On Aug 15, 2006, at 11:09 AM, Dr Nic wrote: > Logan Capaldo wrote: >> You don't always want a has_many :through though. Sometimes the only >> thing that exists is the many-to-many relationship. (A person has and >> belongs to many clubs for instance.) > > Just so I understand, let's play with some tables: > > people =>* group_people *<= groups > > The following sequence of commands should work: > >> person = Person.find_first >> groups = person.groups > > Is that how a HABTM would work too? > > If so, then to emulate a HABTM, you just need to ignore the join table > in your app, and never call peron.group_people, etc. > > My doubt comes from not having used HABTM since the start of the year; > but I think from the object's point of view, the HABTM and the > has_many > :through behave the same to the Person object if you send it the > groups > method. > > Nic > > -- > Posted via http://www.ruby-forum.com/. > Yeah they behave the same, but sometimes you don't want the overhead of creating a model just so AR is satisfied ;)