Class: DqAdmin::UsersController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- DqAdmin::UsersController
- Defined in:
- app/controllers/dq_admin/users_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/dq_admin/users_controller.rb', line 12 def create user = User.create(permit_params) if user.errors.any? flash[:error] = user.errors else redirect_to action: :index end end |
#destroy ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'app/controllers/dq_admin/users_controller.rb', line 39 def destroy @user.destroy if @user.errors.any? flash[:error] = @user.errors else redirect_to action: :index end end |
#edit ⇒ Object
36 37 |
# File 'app/controllers/dq_admin/users_controller.rb', line 36 def edit end |
#index ⇒ Object
8 9 10 |
# File 'app/controllers/dq_admin/users_controller.rb', line 8 def index @users = User.page(params[:page]) end |
#new ⇒ Object
22 23 24 |
# File 'app/controllers/dq_admin/users_controller.rb', line 22 def new @user = User.new end |
#update ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'app/controllers/dq_admin/users_controller.rb', line 26 def update @user.update(permit_params.reject {|key, value| value.blank?}) if @user.errors.any? flash[:error] = @user.errors else redirect_to action: :index end end |