Class: Admin::UsersController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/admin/users_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



16
17
18
19
20
21
22
23
24
25
# File 'app/controllers/admin/users_controller.rb', line 16

def create
    @user = User.new(params[:user])
    
    if @user.respond_to?(:author)
      @user.author ||= current_user
    end
    
    @user.save
    respond_with(@user)
end

#destroyObject



33
34
35
36
# File 'app/controllers/admin/users_controller.rb', line 33

def destroy
  @user.destroy
  respond_with(@user)
end

#editObject



13
14
# File 'app/controllers/admin/users_controller.rb', line 13

def edit
end

#indexObject



4
5
6
7
# File 'app/controllers/admin/users_controller.rb', line 4

def index
  @search = User.search(params[:search])
  @users = @search.page(params[:page] || 1)
end

#newObject



9
10
11
# File 'app/controllers/admin/users_controller.rb', line 9

def new
  @user = User.new  
end

#updateObject



27
28
29
30
31
# File 'app/controllers/admin/users_controller.rb', line 27

def update
  @user.attributes = params[:user]
  @user.save
  respond_with(@user)
end