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
26 27 28 29 30 31 32 33 |
# File 'app/controllers/manage/admins_controller.rb', line 26 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
10 11 12 |
# File 'app/controllers/manage/admins_controller.rb', line 10 def datatable render json: AdminDatatable.new(view_context) end |
#destroy ⇒ Object
40 41 42 43 |
# File 'app/controllers/manage/admins_controller.rb', line 40 def destroy @user.destroy respond_with(:manage, @user, location: manage_admins_path) end |
#edit ⇒ Object
23 24 |
# File 'app/controllers/manage/admins_controller.rb', line 23 def edit end |
#index ⇒ Object
6 7 8 |
# File 'app/controllers/manage/admins_controller.rb', line 6 def index respond_with(:manage, User.where(admin: true)) end |
#new ⇒ Object
18 19 20 21 |
# File 'app/controllers/manage/admins_controller.rb', line 18 def new @user = ::User.new respond_with(:manage, @user) end |
#show ⇒ Object
14 15 16 |
# File 'app/controllers/manage/admins_controller.rb', line 14 def show respond_with(:manage, @user) end |
#update ⇒ Object
35 36 37 38 |
# File 'app/controllers/manage/admins_controller.rb', line 35 def update @user.update_attributes(user_params) respond_with(:manage, @user, location: manage_admins_path) end |