Class: Profiles::PreferencesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/profiles/preferences_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject


4
5
# File 'app/controllers/profiles/preferences_controller.rb', line 4

def show
end

#updateObject


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/profiles/preferences_controller.rb', line 7

def update
  begin
    if @user.update_attributes(preferences_params)
      flash[:notice] = 'Preferences saved.'
    else
      flash[:alert] = 'Failed to save preferences.'
    end
  rescue ArgumentError => e
    # Raised when `dashboard` is given an invalid value.
    flash[:alert] = "Failed to save preferences (#{e.message})."
  end

  respond_to do |format|
    format.html { redirect_to profile_preferences_path }
    format.js
  end
end