Class: UsersController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- UsersController
- Defined in:
- app/controllers/users_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/users_controller.rb', line 15 def create @user = User.new(params[:user]) set_target_page if @user.save [:auth_token] = @user.auth_token # logging in the user redirect_to session[:target_page] || safe_root_url, notice: t('authentication.signup_confirmation') session[:target_page] = nil else render "new" end end |
#index ⇒ Object
6 7 8 9 |
# File 'app/controllers/users_controller.rb', line 6 def index @users = User.by_recent render layout: 'admin' end |
#make_admin ⇒ Object
27 28 29 30 31 32 |
# File 'app/controllers/users_controller.rb', line 27 def make_admin user = User.find(params[:id]) user.admin = true user.save redirect_to users_path, notice: t('authentication.admin_enabled_confirmation') end |
#new ⇒ Object
11 12 13 |
# File 'app/controllers/users_controller.rb', line 11 def new @user = User.new end |
#remove_admin ⇒ Object
34 35 36 37 38 39 |
# File 'app/controllers/users_controller.rb', line 34 def remove_admin user = User.find(params[:id]) user.admin = false user.save redirect_to users_path, notice: t('authentication.admin_disabled_confirmation') end |