Simplify query to retrieve NotificationSetting on controllers
This commit is contained in:
parent
d11288be95
commit
127119f2c4
|
@ -1,6 +1,6 @@
|
|||
class Groups::NotificationSettingsController < Groups::ApplicationController
|
||||
def update
|
||||
notification_setting = group.notification_settings.where(user_id: current_user).find(params[:id])
|
||||
notification_setting = group.notification_settings.find_by(user_id: current_user)
|
||||
saved = notification_setting.update_attributes(notification_setting_params)
|
||||
|
||||
render json: { saved: saved }
|
||||
|
|
|
@ -8,7 +8,7 @@ class Projects::NotificationSettingsController < Projects::ApplicationController
|
|||
end
|
||||
|
||||
def update
|
||||
notification_setting = project.notification_settings.where(user_id: current_user).find(params[:id])
|
||||
notification_setting = project.notification_settings.find_by(user_id: current_user)
|
||||
saved = notification_setting.update_attributes(notification_setting_params)
|
||||
|
||||
render json: { saved: saved }
|
||||
|
|
Loading…
Reference in New Issue