Class: Admin::UsersController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Admin::UsersController
- Defined in:
- app/controllers/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
25 26 27 28 29 30 31 32 |
# File 'app/controllers/admin/users_controller.rb', line 25 def create @user = SpudUser.new(user_params) if @user.save render 'show', :status => 200 else render 'new', :status => 422 end end |
#destroy ⇒ Object
43 44 45 46 |
# File 'app/controllers/admin/users_controller.rb', line 43 def destroy @user.destroy respond_with @user, :location => admin_users_path end |
#edit ⇒ Object
34 35 36 |
# File 'app/controllers/admin/users_controller.rb', line 34 def edit respond_with @user end |
#index ⇒ Object
8 9 10 11 12 13 14 |
# File 'app/controllers/admin/users_controller.rb', line 8 def index @spud_users = SpudUser.ordered.paginate(:page => params[:page], :per_page => 15) if params[:search] @spud_users = @spud_users.where_name_like(params[:search]) end respond_with @spud_users end |
#new ⇒ Object
20 21 22 23 |
# File 'app/controllers/admin/users_controller.rb', line 20 def new @user = SpudUser.new respond_with @user end |
#show ⇒ Object
16 17 18 |
# File 'app/controllers/admin/users_controller.rb', line 16 def show respond_with @user end |
#update ⇒ Object
38 39 40 41 |
# File 'app/controllers/admin/users_controller.rb', line 38 def update @user.update_attributes(user_params) respond_with @user, :location => admin_user_path(@user), :status => 200 end |