Class: Api::NotificationsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Api::NotificationsController
- Defined in:
- app/controllers/wupee/api/notifications_controller.rb
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
5 6 7 8 9 10 11 |
# File 'app/controllers/wupee/api/notifications_controller.rb', line 5 def index if params[:is_read] @notifications = current_user.notifications.where(is_read: params[:is_read] == "true") else @notifications = current_user.notifications end end |
#show ⇒ Object
13 14 |
# File 'app/controllers/wupee/api/notifications_controller.rb', line 13 def show end |
#update ⇒ Object
16 17 18 19 |
# File 'app/controllers/wupee/api/notifications_controller.rb', line 16 def update @notification.mark_as_read render :show end |
#update_all ⇒ Object
21 22 23 24 25 26 |
# File 'app/controllers/wupee/api/notifications_controller.rb', line 21 def update_all current_user.notifications.where(is_read: false).find_each do |n| n.mark_as_read end head :no_content end |