Class: SessionControllerFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/rails-caddy/session_controller_finder.rb

Overview

Responsible for locating the controller responsible for establishing the session

Class Method Summary collapse

Class Method Details

.findObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/rails-caddy/session_controller_finder.rb', line 3

def self.find
  if !Object.const_defined?(:ApplicationController)
    raise RailsCaddy::SessionControllerNotFoundError, 
      "Cannot find ApplicationController.  If you're sure that you have defined it, try adding require_dependency 'application_controller' prior to invoking RailsCaddy.init!"
  end
  
  candidate = ApplicationController
  # if candidate.session_options[:key].nil?
  #   raise RailsCaddy::SessionUninitializedError, 
  #     "session does not appear to be established for #{candidate.class}. session: #{candidate.session_options.inspect}"
  # end
  
  candidate
end