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
35 36 37 38 39 40 41 42 |
# File 'app/controllers/admin/users_controller.rb', line 35 def create @user = SpudUser.new(user_params) if @user.save render 'show', :status => 200 else render 'new', :status => 422 end end |
#destroy ⇒ Object
53 54 55 56 |
# File 'app/controllers/admin/users_controller.rb', line 53 def destroy @user.destroy respond_with @user, :location => admin_users_path end |
#edit ⇒ Object
44 45 46 |
# File 'app/controllers/admin/users_controller.rb', line 44 def edit respond_with @user end |
#index ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/admin/users_controller.rb', line 9 def index @users = SpudUser.order('login asc') if params[:search] @users = @users.where_name_like(params[:search]) end @users = @users.paginate(:page => params[:page]) respond_with @users do |format| format.html{ if request.xhr? render :partial => 'index' else render 'index', :layout => 'admin/detail' end } end end |
#new ⇒ Object
30 31 32 33 |
# File 'app/controllers/admin/users_controller.rb', line 30 def new @user = SpudUser.new respond_with @user end |
#show ⇒ Object
26 27 28 |
# File 'app/controllers/admin/users_controller.rb', line 26 def show respond_with @user end |
#update ⇒ Object
48 49 50 51 |
# File 'app/controllers/admin/users_controller.rb', line 48 def update @user.update_attributes(user_params) respond_with @user, :location => admin_user_path(@user), :status => 200 end |