Skip to content

Instantly share code, notes, and snippets.

@meltzerj
Created May 7, 2011 00:18
Show Gist options
  • Select an option

  • Save meltzerj/960050 to your computer and use it in GitHub Desktop.

Select an option

Save meltzerj/960050 to your computer and use it in GitHub Desktop.
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
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