Class: UsersController
- Inherits:
-
ApplicationController
- Object
- ControllerBase
- ApplicationController
- UsersController
- Defined in:
- lib/scaffold/app/controllers/users_controller.rb
Constant Summary
Constants included from ControllerCallbacks
Instance Attribute Summary
Attributes inherited from ControllerBase
Instance Method Summary collapse
Methods inherited from ApplicationController
#current_user, #ensure_login, #ensure_logout, #logged_in?, #login, #logout
Methods inherited from ControllerBase
#form_authenticity_token, #initialize, #invoke_action, #link_to, protect_from_forgery, #root_url
Methods included from ControllerCallbacks
Constructor Details
This class inherits a constructor from ControllerBase
Instance Method Details
#create ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/scaffold/app/controllers/users_controller.rb', line 16 def create @user = User.new(user_params) if @user.save login(@user) redirect_to bands_url else flash.now[:errors] = @user.errors render :new end end |
#destroy ⇒ Object
27 28 29 30 31 |
# File 'lib/scaffold/app/controllers/users_controller.rb', line 27 def destroy user = User.find(params[:id]) user.destroy redirect_to users_url end |
#index ⇒ Object
4 5 6 |
# File 'lib/scaffold/app/controllers/users_controller.rb', line 4 def index @users = User.all end |