Sha256: c9638c40f110849f82954a7311073e12ca9c4b31bdd8e23655617bf3e746e2cd
Contents?: true
Size: 921 Bytes
Versions: 3
Compression:
Stored size: 921 Bytes
Contents
class Admin::PreferencesController < ApplicationController before_filter :load_user def initialize @controller_name = 'user' @template_name = 'preferences' end def show redirect_to :action => 'edit' end def edit render end 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 private def load_user @user = current_user end def valid_params? hash = (params[:user] || {}).symbolize_keys (hash.keys - [:password, :password_confirmation, :email]).size == 0 end def announce_bad_data flash[:error] = 'Bad form data.' end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
radiant-0.7.2 | app/controllers/admin/preferences_controller.rb |
radiant-0.7.0 | app/controllers/admin/preferences_controller.rb |
radiant-0.7.1 | app/controllers/admin/preferences_controller.rb |