Complex relations

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