Class: Admin::AdminUsersController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Admin::AdminUsersController
- Defined in:
- app/controllers/admin/admin_users_controller.rb
Defined Under Namespace
Classes: Collection
Instance Attribute Summary collapse
-
#admin ⇒ Object
readonly
Returns the value of attribute admin.
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Attribute Details
#admin ⇒ Object (readonly)
Returns the value of attribute admin.
7 8 9 |
# File 'app/controllers/admin/admin_users_controller.rb', line 7 def admin @admin end |
Instance Method Details
#create ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/admin/admin_users_controller.rb', line 29 def create admin = Admin::User.new(admin_user_params) if admin.save redirect_to admin_admin_user_path(admin) else render :new, locals: { admin: }, status: :unprocessable_entity end end |
#destroy ⇒ Object
47 48 49 50 51 |
# File 'app/controllers/admin/admin_users_controller.rb', line 47 def destroy admin.destroy redirect_to admin_admin_users_path end |
#edit ⇒ Object
25 26 27 |
# File 'app/controllers/admin/admin_users_controller.rb', line 25 def edit render :edit, locals: { admin: } end |
#index ⇒ Object
9 10 11 12 13 |
# File 'app/controllers/admin/admin_users_controller.rb', line 9 def index collection = Collection.new.with_params(params).apply(Admin::User.strict_loading) render locals: { collection: } end |
#new ⇒ Object
19 20 21 22 23 |
# File 'app/controllers/admin/admin_users_controller.rb', line 19 def new @admin = Admin::User.new render :new, locals: { admin: } end |
#show ⇒ Object
15 16 17 |
# File 'app/controllers/admin/admin_users_controller.rb', line 15 def show render :show, locals: { admin: } end |
#update ⇒ Object
39 40 41 42 43 44 45 |
# File 'app/controllers/admin/admin_users_controller.rb', line 39 def update if admin.update(admin_user_params) redirect_to action: :show else render :edit, locals: { admin: }, status: :unprocessable_entity end end |