Class: UsersController

Inherits:
ApplicationController
  • Object
show all
Defined in:
lib/generators/lab/setup/templates/devise/users_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



16
17
18
19
20
21
22
23
# File 'lib/generators/lab/setup/templates/devise/users_controller.rb', line 16

def create
  @user = User.new(params[:user])
  if @user.save
    redirect_to(users_url, :notice => "User created with success.")
  else
    render :new
  end
end

#destroyObject



38
39
40
41
42
# File 'lib/generators/lab/setup/templates/devise/users_controller.rb', line 38

def destroy
  @user = User.find(params[:id])
  @user.destroy
  redirect_to(users_url, :notice => "User deleted with success.")
end

#editObject



25
26
27
# File 'lib/generators/lab/setup/templates/devise/users_controller.rb', line 25

def edit
  @user = User.find(params[:id])
end

#indexObject



4
5
6
# File 'lib/generators/lab/setup/templates/devise/users_controller.rb', line 4

def index
  @users = User.all(:conditions => search_conditions)
end

#newObject



12
13
14
# File 'lib/generators/lab/setup/templates/devise/users_controller.rb', line 12

def new
  @user = User.new
end

#showObject



8
9
10
# File 'lib/generators/lab/setup/templates/devise/users_controller.rb', line 8

def show
  @user = User.find(params[:id])
end

#updateObject



29
30
31
32
33
34
35
36
# File 'lib/generators/lab/setup/templates/devise/users_controller.rb', line 29

def update
  @user = User.find(params[:id])
  if @user.update_attributes(params[:user])
    redirect_to(users_url, :notice => "User updated with success.")
  else
    render :edit
  end
end