module NotificationsHelper

Public Instance Methods

path_for_notification(notification) click to toggle source

Generates path for notification.

# File app/helpers/notifications_helper.rb, line 9
def path_for_notification(notification)
  if notification.owner.persisted?
    case notification.trackable_type
      when 'Invoice'
        invoices_path()
      when 'Event'
        personal_calendar_path()
      when 'ActsAsVotable::Vote'
        profile_path(notification.owner)
      when 'TutoringSession'
        dashboard_path()
      when 'ProfileVisit'
        profile_path(notification.owner)
    end
  end
end
unread_notifications_count() click to toggle source

Returns unread notifications count.

# File app/helpers/notifications_helper.rb, line 4
def unread_notifications_count
  current_user.cached_notification_count
end