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 |
# File 'app/controllers/admin/users_controller.rb', line 35 def create @user = SpudUser.create(user_params) respond_with @user, :location => admin_users_path end |
#destroy ⇒ Object
61 62 63 64 65 66 67 68 |
# File 'app/controllers/admin/users_controller.rb', line 61 def destroy @user.destroy respond_with @user, :location => admin_users_path do |format| format.js{ render :nothing => true, :status => 200 } end end |
#edit ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 |
# File 'app/controllers/admin/users_controller.rb', line 40 def edit respond_with @user do |format| format.html{ if request.xhr? render 'edit', :layout => false else render 'edit' end } end end |
#index ⇒ Object
10 11 12 13 14 15 16 |
# File 'app/controllers/admin/users_controller.rb', line 10 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
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/admin/users_controller.rb', line 22 def new @user = SpudUser.new respond_with @user do |format| format.html{ if request.xhr? render 'new', :layout => false else render 'new' end } end end |
#show ⇒ Object
18 19 20 |
# File 'app/controllers/admin/users_controller.rb', line 18 def show respond_with @user end |
#update ⇒ Object
52 53 54 55 56 57 58 59 |
# File 'app/controllers/admin/users_controller.rb', line 52 def update if @user.update_attributes(user_params) if @user == current_user && user_params[:password].present? SpudUserSession.create(@user) end end respond_with @user, :location => admin_user_path(@user), :status => 200 end |