Created
May 7, 2011 00:18
-
-
Save meltzerj/960050 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
| def erase_notification_count | |
| self.new_notification_count = (self.notifications.count * (-1)) | |
| self.save | |
| end | |
| def notification_count | |
| if self.new_notification_count.nil? | |
| new_notification_count = 0 | |
| end | |
| self.new_notification_count += self.notifications.count | |
| end |
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
| def notifications | |
| erase_notification_count(current_user) | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment