Class: Tramway::SessionsController

Inherits:
ApplicationController show all
Includes:
AuthManagement
Defined in:
app/controllers/tramway/sessions_controller.rb

Instance Method Summary collapse

Methods included from AuthManagement

#authenticate_user!, #current_user, #sign_in, #sign_out, #signed_in?

Methods included from RecordRoutesHelper

#edit_record_path, #new_record_path, #record_path, #records_path

Methods included from Filtering

#date_filter, #filtering, #list_filtering, #list_filtering_dates, #list_filtering_select

Methods included from ClassNameHelpers

#decorator_class_name, #form_class_name, #model_class_name

Instance Method Details

#createObject



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

def create
  @session_form = Tramway::SessionForm.new record

  if @session_form.validate params[:user]
     @session_form.model
    redirect_to root_path
  else
    render :new
  end
end

#destroyObject



27
28
29
30
31
32
# File 'app/controllers/tramway/sessions_controller.rb', line 27

def destroy
  root_path = Tramway::Engine.routes.url_helpers.root_path
  sign_out

  redirect_to params[:redirect] || root_path
end

#newObject



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

def new
  @session_form = Tramway::SessionForm.new Tramway::User.new
end