Class: Spud::UsersController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Spud::UsersController
- Defined in:
- app/controllers/spud/users_controller.rb
Instance Method Summary collapse
Instance Method Details
#save_setting ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/controllers/spud/users_controller.rb', line 26 def save_setting if params[:key].blank? render :status => 500,:text => nil and return end setting = @current_user.spud_user_settings.where(:key => params[:key]).first if setting.blank? setting = @current_user.spud_user_settings.new(:key => params[:key]) end setting.value = params[:value] if setting.save render :status => 200,:text => nil and return else render :status => 500,:text => nil and return end end |
#settings ⇒ Object
5 6 7 8 9 |
# File 'app/controllers/spud/users_controller.rb', line 5 def settings "Settings", :spud_settings_path @page_thumbnail = "spud/admin/users_thumb.png" @page_name = "Settings" end |
#update ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/controllers/spud/users_controller.rb', line 11 def update "Settings", :spud_settings_path @page_thumbnail = "spud/admin/users_thumb.png" @page_name = "Settings" if @current_user.update_attributes(params[:spud_user].slice :login,:first_name,:last_name,:email,:password,:password_confirmation,:time_zone) flash[:notice] = "User settings saved successfully." redirect_to spud_admin_root_url() else flash[:error] = "There was an error while saving the user." render :action => "settings" end end |