Class: Admin::UsersController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Admin::UsersController
- Defined in:
- app/controllers/admin/users_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'app/controllers/admin/users_controller.rb', line 14 def create @user = User.new(user_params) if @user.save redirect_to admin_users_path, success: t('snapuser.admin.new.success') else render 'new' end end |
#destroy ⇒ Object
36 37 38 39 |
# File 'app/controllers/admin/users_controller.rb', line 36 def destroy User.find(params[:id]).destroy redirect_to admin_users_path, success: t('snapuser.admin.destroy.success') end |
#edit ⇒ Object
23 24 25 |
# File 'app/controllers/admin/users_controller.rb', line 23 def edit @user = User.find(params[:id]) end |
#index ⇒ Object
5 6 7 8 |
# File 'app/controllers/admin/users_controller.rb', line 5 def index @table = Table.new(self, User) @table.respond end |
#new ⇒ Object
10 11 12 |
# File 'app/controllers/admin/users_controller.rb', line 10 def new @user = User.new end |
#update ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'app/controllers/admin/users_controller.rb', line 27 def update @user = User.find(params[:id]) if @user.update_attributes(user_params) redirect_to admin_users_path, success: t('snapuser.admin.edit.success') else render 'edit' end end |