Hello, I am working with 3 models: user, band, event. - A user has many bands and a bands has many users. - An event has one band, and a band has many events. the association I am trying to do is between users ands events. I tried has many through but the is not working because the foreign key is not the the table but in an association table. How could I do this? Greg :) -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
You mean you want to get all the events associated with a user''s bands? try User has_many :events, :through => :bands I just tested this with an equivalent pair of associations and it worked fine. Although this will work as a ''get'' association i''m not sure if it will work as a way of adding events to users, since you''d need to provide details of the joining band. You should beware of triangular association sets like this anyway. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.