Skip to content

Instantly share code, notes, and snippets.

@mbleigh
Created July 22, 2009 20:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbleigh/152257 to your computer and use it in GitHub Desktop.
Save mbleigh/152257 to your computer and use it in GitHub Desktop.
class SoundWalk < ActiveRecord::Base
belongs_to :user
named_scope :from_users, lambda{ |users| {:conditions => ["user_id IN (?)", users.collect{|u| u.id}]} }
end
class User < ActiveRecord::Base
def friend_soundwalks
SoundWalk.from_users(self.friends)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment