Class: UserSessionsController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#not_authenticated, #set_locale

Instance Method Details

#createObject


8
9
10
11
12
13
14
15
# File 'app/controllers/user_sessions_controller.rb', line 8

def create
  if @user = ([:email], [:password])
    redirect_back_or_to(root_path, notice: "Login successfull")
  else
    flash.now[:alert] = "Login failed!"
    render action: "new"
  end
end

#destroyObject


17
18
19
20
# File 'app/controllers/user_sessions_controller.rb', line 17

def destroy
  logout
  redirect_to(root_path, notice: "Logged out")
end

#newObject


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

def new
  @user = User.new
end