Sha256: 93a11b0c750f52a8957f018294ef7a2d10209b5fe0c2b1c615e3f40107ad9614
Contents?: true
Size: 910 Bytes
Versions: 1
Compression:
Stored size: 910 Bytes
Contents
class Admin::PreferencesController < AdminController before_filter :load_user def initialize @controller_name = 'user' @template_name = 'preferences' end def show set_standard_body_style render :edit, :layout => 'radiant' end def edit render :layout => 'radiant' end def update if valid_params? if @user.update_attributes(params[:user]) redirect_to :action => 'show' else flash[:error] = t('preferences_controller.error_updating') render :edit, :layout => 'radiant' end else announce_bad_data render :edit, :layout => 'radiant' end end private def load_user @user = current_user end def valid_params? hash = (params[:user] || {}).symbolize_keys (hash.keys - User.unprotected_attributes).size == 0 end def announce_bad_data flash[:error] = 'Bad form data.' end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
radiant-rails3-0.1 | app/controllers/admin/preferences_controller.rb |