Created
May 26, 2011 07:10
-
-
Save meltzerj/992695 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
| '((actor_type = \'User\' AND actor_id IN (SELECT followed_id FROM relationships WHERE follower_id = #{id})) AND ((secondary_subject_type = \'Video\' AND subject_type <> \'Profile\' AND secondary_subject_id NOT IN (SELECT id FROM videos WHERE user_id = #{id})) OR (secondary_subject_type = \'User\' AND secondary_subject_id <> #{id}) OR (secondary_subject_type = \'nil\') OR (subject_type = \'Profile\' AND secondary_subject_id NOT IN (SELECT id FROM videos WHERE user_id = #{id}) AND subject_id NOT IN (SELECT id FROM profiles WHERE user_id = #{id}))))' |
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
| belongs_to :actor, :polymorphic => true | |
| belongs_to :subject, :polymorphic => true | |
| belongs_to :secondary_subject, :polymorphic => true | |
| has_many :user_notifications |
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
| has_many :recent_events, :class_name => "TimelineEvent", | |
| :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