I have the following data model for a simple blog application. A user
is in many groups and posts many entries. Every group displays the
entries of everyone who is a member of that group.
The models look like this:
==User
has_many :memberships
has_many :groups, :through => :memberships
Memberships
belongs_to :user
belongs_to :group
Groups
has_many :memberships
has_many :users, :through => :memberships
Entries
belongs_to :user
==
My question is, what is the cleanest way to display a list of all the
entries in a given group? I currently am using finder_sql but I''m not
sure if that is the cleanest way. Ideally I would be able to do
something like group.entries or group.users.entries.
Any ideas?
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---