Class: Decidim::NotificationsController

Inherits:
ApplicationController show all
Includes:
Paginable
Defined in:
app/controllers/decidim/notifications_controller.rb

Overview

The controller to handle the user’s notifications dashboard.

Constant Summary

Constants included from Paginable

Paginable::OPTIONS

Instance Method Summary collapse

Methods included from NeedsOrganization

enhance_controller, extended, included

Instance Method Details

#destroyObject



17
18
19
20
21
# File 'app/controllers/decidim/notifications_controller.rb', line 17

def destroy
  notification = notifications.find(params[:id])
  authorize! :destroy, notification
  notification.destroy
end

#indexObject



12
13
14
15
# File 'app/controllers/decidim/notifications_controller.rb', line 12

def index
  authorize! :read, Notification
  @notifications = paginate(notifications)
end

#read_allObject



23
24
25
26
# File 'app/controllers/decidim/notifications_controller.rb', line 23

def read_all
  authorize! :destroy, notifications.first
  notifications.destroy_all
end