How to read ruby on rails config values from within the application controller

Viewed 15693

If i have a configuration file like this

# config/environments/integration.rb
config.action_controller.session = {
  :domain => ".example.com"
}

How do I get the value from within my application controller, e.g:

# app/controller/application_controller
class ApplicationController < Mcc::CoreSupport::FrontendController
  def some_method
    value = xxx
  end
end
2 Answers

The class method ActionController::Base.session_options returns a hash of the configuration options for the session.

So in your case you want ActionController::Base.session_options[:domain]

Related