class NotificationsController

Public Instance Methods

index() click to toggle source

Get all the notifications for current user.

# File app/controllers/notifications_controller.rb, line 5
def index
  add_breadcrumb 'Notifications'
  current_user.reset_cached_notification_count
  #FIXME : Need to include profile_image in preload list. Curently htis is a bug in rails
  #https://github.com/rails/rails/issues/16070
  @notifications = current_user.notifications.order('created_at DESC').includes(:owner).page(params[:page]).per(params[:per_page])
  respond_to do |format|
    format.js {}
    format.html do
      render partial: params[:type] if params[:type]
    end
  end
end