Class: ThinkFeelDoEngine::ApplicationController

Inherits:
ApplicationController
  • Object
show all
Includes:
Concerns::BrowserDetective, Concerns::InvalidAuthToken
Defined in:
app/controllers/think_feel_do_engine/application_controller.rb

Overview

Site-wide controller superclass. Inherits from host’s ApplicationController.

Constant Summary collapse

"XSRF-TOKEN"
CSRF_HEADER_NAME =
"X-XSRF-TOKEN"
ROOT_URI =
"/"
INACTIVE_MESSAGE =
"We're sorry, but you can't sign in yet "\
"because you are not assigned to an active group."

Instance Method Summary collapse

Instance Method Details

#access_denied_resource_pathObject



47
48
49
50
51
52
53
# File 'app/controllers/think_feel_do_engine/application_controller.rb', line 47

def access_denied_resource_path
  if defined?(think_feel_do_dashboard)
    think_feel_do_dashboard.root_path
  else
    privacy_policy_path
  end
end

#after_sign_in_path_for(resource) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'app/controllers/think_feel_do_engine/application_controller.rb', line 26

def (resource)
  if resource.class == User
    if defined?(think_feel_do_dashboard)
      think_feel_do_dashboard.root_path
    else
      privacy_policy_path
    end

  else
    super resource
  end
rescue ActionController::UrlGenerationError
  ROOT_URI
end

#after_sign_out_path_for(resource) ⇒ Object



41
42
43
44
45
# File 'app/controllers/think_feel_do_engine/application_controller.rb', line 41

def after_sign_out_path_for(resource)
  session[:previous_url] || (
    resource == :participant ? main_app.root_path : new_user_session_path
  )
end

#raise_not_found!Object

Called by last route matching unmatched routes. Raises an exception that is expected to be rescued.

Raises:

  • (ActionController::RoutingError)


65
66
67
68
# File 'app/controllers/think_feel_do_engine/application_controller.rb', line 65

def raise_not_found!
  raise ActionController::RoutingError,
        "No route matches #{params[:unmatched_route]}"
end

#render_not_found(_) ⇒ Object



70
71
72
# File 'app/controllers/think_feel_do_engine/application_controller.rb', line 70

def render_not_found(_)
  render file: "#{Rails.root}/public/404.html", status: 404
end