# This may be inefficient, but not very easy to optimize unless the data hash
# is converted into a hstore.
defnotification
@notification||=self.user.notifications.where(notification_type:Notification.types[:granted_badge]).where("data LIKE ?","%"+self.badge_id.to_s+"%").select{|n|n.data_hash["badge_id"]==self.badge_id}.first