Class: UsersController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- UsersController
- 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
Instance Method Details
#destroy ⇒ Object
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 |
#index ⇒ Object
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 |
#show ⇒ Object
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 |