Created
May 5, 2011 06:25
-
-
Save meltzerj/956633 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| RECENT_EVENTS_CONDITION = '(actor_type = \'User\' AND actor_id IN (SELECT followed_id FROM relationships WHERE follower_id = #{id}))' | |
| has_many :recent_events, :class_name => "TimelineEvent", | |
| :conditions => :filter_event, | |
| :finder_sql => 'SELECT timeline_events.* FROM timeline_events | |
| WHERE ' + RECENT_EVENTS_CONDITION + ' | |
| ORDER BY timeline_events.created_at DESC', | |
| :counter_sql => 'SELECT COUNT(*) FROM timeline_events | |
| WHERE ' + RECENT_EVENTS_CONDITION |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment