Sha256: f934f6721c2bab9620f43c6dedf40e48c2be765664667178c5fdf77575852066
Contents?: true
Size: 695 Bytes
Versions: 2
Compression:
Stored size: 695 Bytes
Contents
class UsersController < InheritedResources::Base before_filter :user_from_current, :only => :edit filter_resource_access def update params[:user][:password] = nil if params[:user][:password].blank? update! do |success, failure| success.all { redirect_after_update } failure.all { render :edit } end end protected def user_from_current params[:id] ||= (current_user.try(:id) || 0) end def redirect_after_update if @user == current_user sign_in @user, :bypass => true redirect_to user_root_path elsif permitted_to? :show, @user redirect_to user_path(@user) else redirect_to user_root_path end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
daily-0.0.3 | app/controllers/users_controller.rb |
daily-0.0.2 | app/controllers/users_controller.rb |