In our Rails 4.2 app, a method view_handler in module's application controller is getting nil with session variables. Here is the code structure:
class my_module < ApplicationController
def view_handler
#access session[:page_step] which is defined in controller.
end
end
Default cookie store is used for the session:
Rails.application.config.session_store :cookie_store, key: '_my_app_session'
We verified that this is not a scope issue because the problem remains the same when view_handler is moved into main app's application controller.
In debug with application controller, the session object exists but with nil value:
>session.present? #false
>session.nil? #true
>session[:page_step] #nil
Here is the session object in debug. @delegate which holds app defined session variables is empty:
Also in debug, the session[:page_step] re-surfaces again late in controller action. Somehow the session[:page_step] (and other session variables) becomes nil in application controller and re-surface in controller. Since by default session variables in application controller are available in RAILS, what could cause them becoming nil in application controller?
