Class: UsersController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#dev_only, #require_login

Methods included from SessionsHelper

#console?, #current_user, #debug?, #forget, #log_in, #log_out, #logged_in?, #remember, #toggle_console, #toggle_debug

Instance Method Details

#createObject


16
17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/users_controller.rb', line 16

def create
  @user = User.new(user_params)

  if @user.save
     @user
    flash[:success] = "Welcome to lunch! Where your freshman 15 is born."
    redirect_to @user
  else
    render 'new'
  end
end

#indexObject


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

def index
  @users = User.all
end

#newObject


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

def new
  @user = User.new
end

#showObject


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

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