Class: Admin::PreferencesController

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

Instance Method Summary collapse

Constructor Details

#initializePreferencesController

Returns a new instance of PreferencesController.



4
5
6
7
# File 'app/controllers/admin/preferences_controller.rb', line 4

def initialize
  @controller_name = 'user'
  @template_name = 'preferences'
end

Instance Method Details

#editObject



13
14
15
# File 'app/controllers/admin/preferences_controller.rb', line 13

def edit
  render
end

#showObject



9
10
11
# File 'app/controllers/admin/preferences_controller.rb', line 9

def show
  redirect_to :action => 'edit'
end

#updateObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/controllers/admin/preferences_controller.rb', line 17

def update
  if valid_params?
    if @user.update_attributes(params[:user])
      flash[:notice] = 'Your preferences have been updated.'
      redirect_to admin_pages_path
    else
      flash[:error] = 'There was an error updating your preferences.'
      render :action => 'edit'
    end
  else
    announce_bad_data
    render :action => 'edit'
  end
end