Class: Manage::UsersController

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

Instance Method Summary collapse

Instance Method Details

#activateObject

POST /manage/users/1/activate



43
44
45
46
# File 'app/controllers/manage/users_controller.rb', line 43

def activate
  @user.confirm!    
  respond_with(@user, :location => manage_users_path)
end

#createObject



29
30
31
32
# File 'app/controllers/manage/users_controller.rb', line 29

def create
  @user.attributes = params[:user]
  create! { manage_users_path } 
end

#destroyObject



38
39
40
# File 'app/controllers/manage/users_controller.rb', line 38

def destroy
  destroy!{ manage_users_path }
end

#indexObject



19
20
21
22
23
24
25
26
27
# File 'app/controllers/manage/users_controller.rb', line 19

def index
  index! do |format|
    format.csv { send_data(User.to_csv, :filename => "users_#{Date.today}.csv", :type => "text/csv") }
    format.json do
      @users = User.with_email(params[:term]).includes(:avatar).select("users.id, users.name, users.email").limit(50)
      render :json => @users.as_json(:methods => [:avatar_small_url])
    end
  end
end

#suspendObject

POST /manage/users/1/suspend



49
50
51
52
# File 'app/controllers/manage/users_controller.rb', line 49

def suspend
  @user.suspend! 
  respond_with(@user, :location => manage_users_path)
end

#unlockObject

POST /manage/users/1/unlock



61
62
63
64
# File 'app/controllers/manage/users_controller.rb', line 61

def unlock
  @user.unlock_access!
  respond_with(@user, :location => manage_users_path)
end

#unsuspendObject

POST /manage/users/1/unsuspend



55
56
57
58
# File 'app/controllers/manage/users_controller.rb', line 55

def unsuspend
  @user.unsuspend!
  respond_with(@user, :location => manage_users_path)
end

#updateObject



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

def update
  update!{ manage_users_path }
end