Class: Admin::AccountsController
- Inherits:
-
AdminCartoonistController
- Object
- AdminCartoonistController
- Admin::AccountsController
- Defined in:
- app/controllers/admin/accounts_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
9 10 11 12 |
# File 'app/controllers/admin/accounts_controller.rb', line 9 def create user = User.create_user params redirect_to "/admin/accounts" end |
#destroy ⇒ Object
27 28 29 30 31 |
# File 'app/controllers/admin/accounts_controller.rb', line 27 def destroy raise "Cannot destroy yourself!" if current_user.id == params[:id].to_i User.delete_user params redirect_to "/admin/accounts" end |
#edit ⇒ Object
18 19 20 |
# File 'app/controllers/admin/accounts_controller.rb', line 18 def edit @user = User.find params[:id].to_i end |
#index ⇒ Object
2 3 4 |
# File 'app/controllers/admin/accounts_controller.rb', line 2 def index @users = User.order(:name).to_a end |
#new ⇒ Object
6 7 |
# File 'app/controllers/admin/accounts_controller.rb', line 6 def new end |
#show ⇒ Object
14 15 16 |
# File 'app/controllers/admin/accounts_controller.rb', line 14 def show @user = User.find params[:id].to_i end |
#update ⇒ Object
22 23 24 25 |
# File 'app/controllers/admin/accounts_controller.rb', line 22 def update user = User.update_user params redirect_to "/admin/accounts/#{user.id}" end |