Hi,

  I wanted to ask, whether someone could help me. I have in my project
quite a lot of complex relations between my models. For example:

has_many :some_groups, :class_name => 'Group', :finder_sql => '
SELECT DISTINCT groups.* FROM groups
      JOIN memberships ON memberships.group_id=groups.id AND
memberships.active = 1
      JOIN users ON memberships.user_id = users.id AND users.active =
1
      JOIN memberships AS ms ON ms.user_id = users.id AND ms.active =
1
        AND ms.group_id = #{self.group.id}
      WHERE groups.kind_id = 3

Is it possible to simplify such a thing into more rubyish code ?

Thanks

Marek

--~--~---------~--~----~------------~-------~--~----~
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