Class: Integral::Backend::NotificationSubscriptionsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/integral/backend/notification_subscriptions_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#activities, #activity, #create, #destroy, #duplicate, #edit, #index, #list, #new, #show

Instance Method Details

#updateObject



4
5
6
7
8
9
10
11
12
13
# File 'app/controllers/integral/backend/notification_subscriptions_controller.rb', line 4

def update
  subscription = current_user.own_notification_subscriptions.find_or_initialize_by(resource_params.except('state'))
  subscription.state = resource_params['state']

  if subscription.save
    head :ok
  else
    head :unprocessable_entity
  end
end