Created
May 7, 2011 08:11
-
-
Save meltzerj/960309 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
| has_many :user_notifications | |
| NOTIFICATIONS_CONDITION = '(actor_type = \'User\' AND ((secondary_subject_type = \'Video\' AND secondary_subject_id IN (SELECT id FROM videos WHERE user_id = #{id})) OR (secondary_subject_type = \'User\' AND secondary_subject_id = #{id})))' | |
| has_many :notifications, :through => :user_notifications, | |
| :finder_sql => 'SELECT timeline_events.* FROM timeline_events | |
| WHERE ' + NOTIFICATIONS_CONDITION + ' | |
| ORDER BY timeline_events.created_at DESC' |
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 :user | |
| belongs_to :notification, :classname => 'TimelineEvent' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment