Class: Munificent::Admin::UsersController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Munificent::Admin::UsersController
- Defined in:
- app/controllers/munificent/admin/users_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
14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/munificent/admin/users_controller.rb', line 14 def create if @user.save flash[:notice] = "User created" redirect_to edit_user_path(@user) else flash[:alert] = @user.errors..join(", ") redirect_to new_user_path end end |
#destroy ⇒ Object
41 42 43 44 |
# File 'app/controllers/munificent/admin/users_controller.rb', line 41 def destroy @user.destroy redirect_to users_path end |
#edit ⇒ Object
12 |
# File 'app/controllers/munificent/admin/users_controller.rb', line 12 def edit; end |
#index ⇒ Object
6 7 8 |
# File 'app/controllers/munificent/admin/users_controller.rb', line 6 def index (:read, :user_accounts) end |
#new ⇒ Object
11 |
# File 'app/controllers/munificent/admin/users_controller.rb', line 11 def new; end |
#show ⇒ Object
10 |
# File 'app/controllers/munificent/admin/users_controller.rb', line 10 def show; end |
#update ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/controllers/munificent/admin/users_controller.rb', line 24 def update model = :user if params[model][:password].blank? %w[password password_confirmation].each { |p| params[model].delete(p) } end @user.assign_attributes(user_params) if @user.save flash[:notice] = "User saved" else flash[:alert] = @user.errors..join(", ") end redirect_to edit_user_path(@user) end |