Class: Manage::AdminsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Manage::AdminsController
- Defined in:
- app/controllers/manage/admins_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #datatable ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'app/controllers/manage/admins_controller.rb', line 25 def create @user = ::User.new(user_params.merge(password: Devise.friendly_token.first(10))) if @user.save @user.update_attribute(:admin, true) @user.send_reset_password_instructions end respond_with(:manage, @user, location: manage_admins_path) end |
#datatable ⇒ Object
9 10 11 |
# File 'app/controllers/manage/admins_controller.rb', line 9 def datatable render json: AdminDatatable.new(view_context) end |
#destroy ⇒ Object
39 40 41 42 |
# File 'app/controllers/manage/admins_controller.rb', line 39 def destroy @user.destroy respond_with(:manage, @user, location: manage_admins_path) end |
#edit ⇒ Object
22 23 |
# File 'app/controllers/manage/admins_controller.rb', line 22 def edit end |
#index ⇒ Object
6 7 |
# File 'app/controllers/manage/admins_controller.rb', line 6 def index end |
#new ⇒ Object
17 18 19 20 |
# File 'app/controllers/manage/admins_controller.rb', line 17 def new @user = ::User.new respond_with(:manage, @user) end |
#show ⇒ Object
13 14 15 |
# File 'app/controllers/manage/admins_controller.rb', line 13 def show respond_with(:manage, @user) end |
#update ⇒ Object
34 35 36 37 |
# File 'app/controllers/manage/admins_controller.rb', line 34 def update @user.update_attributes(user_params) respond_with(:manage, @user, location: manage_admins_path) end |