I have the following schema.

table: user
  t.column :id, :integer

table: friends
  t.column :user_id,   :integer  #Owner of this friendship
  t.column :friend_id, :integer  #FK to User table

table: activity
  t.column :user_id

Basically I want to display all activity from friends that i have

I currently have the following has_many finder...

has_many :friend_activities,
    :class_name => 'Activity',
    :finder_sql => 'select a.* from activities a, friend f where
a.user_id = f.friend_id and f.user_id = #{id}'

Is it even possible to change the above has_many to not user
the :finder_sql but using some combination
of :through, :source ... ???? If so can someone please help.

--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
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