Sha256: 87e18137d0b174df2b630b80059e20a14c15f6f2ac30ed02ae130cb53afa4c59

Contents?: true

Size: 576 Bytes

Versions: 2

Compression:

Stored size: 576 Bytes

Contents

class UsersController < ApplicationController
  before_action except: [:profile] { |c| c.authorize_level(2) }
  before_action only: [:profile] { |c| c.authorize_level(4) }
  layout 'admin'

  def profile
  end

  def edit
    @user = current_user
  end

  def update
    @user = current_user
    if @user.update_attributes(user_params)
      sign_in @user
      redirect_to profile_path, success: t('user.edit.success')
    else
      render 'new'
    end
  end

  private

  def user_params
    params.require(:user).permit(:name, :password, :password_confirmation)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
snapuser-0.1.1 app/controllers/users_controller.rb
snapuser-0.1.0 app/controllers/users_controller.rb