Class: UsersController

Inherits:
ApplicationController show all
Defined in:
lib/generators/chapter07/begin/templates/app/controllers/users_controller.rb,
lib/generators/chapter07/solutions/templates/app/controllers/users_controller.rb,
lib/generators/chapter10/solutions/templates/app/controllers/users_controller.rb,
lib/generators/chapter11_2/solutions/templates/app/controllers/users_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#after_sign_in_path_for

Instance Method Details

#destroyObject



16
17
18
19
20
# File 'lib/generators/chapter10/solutions/templates/app/controllers/users_controller.rb', line 16

def destroy
  User.find(params[:id]).destroy
  flash[:notice] = "User destroyed."
  redirect_to users_path
end

#indexObject



11
12
13
14
# File 'lib/generators/chapter10/solutions/templates/app/controllers/users_controller.rb', line 11

def index
  @title = "All users"
  @users = User.paginate(:page => params[:page])
end

#showObject



3
4
5
6
# File 'lib/generators/chapter07/solutions/templates/app/controllers/users_controller.rb', line 3

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