Class: Thredded::PreferencesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/thredded/preferences_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#signed_in?

Instance Method Details

#edit ⇒ Object



5
6
# File 'app/controllers/thredded/preferences_controller.rb', line 5

def edit
end

#preference ⇒ Object



14
15
16
17
18
# File 'app/controllers/thredded/preferences_controller.rb', line 14

def preference
  @preference ||= NotificationPreference
    .where(messageboard_id: messageboard.id, user_id: thredded_current_user.id)
    .first_or_create!
end

#update ⇒ Object



8
9
10
11
12
# File 'app/controllers/thredded/preferences_controller.rb', line 8

def update
  preference.update_attributes(preference_params)

  redirect_to :back, flash: { notice: 'Your settings have been updated.' }
end