Class: UsersController

Inherits:
ApplicationController show all
Defined in:
lib/scaffold/app/controllers/users_controller.rb

Constant Summary

Constants included from ControllerCallbacks

ControllerCallbacks::METHODS

Instance Attribute Summary

Attributes inherited from ControllerBase

#params, #req, #res

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

#before_action

Constructor Details

This class inherits a constructor from ControllerBase

Instance Method Details

#createObject



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
    (@user)
    redirect_to bands_url
  else
    flash.now[:errors] = @user.errors
    render :new
  end
end

#destroyObject



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

#indexObject



4
5
6
# File 'lib/scaffold/app/controllers/users_controller.rb', line 4

def index
  @users = User.all
end

#newObject



12
13
14
# File 'lib/scaffold/app/controllers/users_controller.rb', line 12

def new
  @user = User.new
end

#showObject



8
9
10
# File 'lib/scaffold/app/controllers/users_controller.rb', line 8

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