If i have a configuration file like this
# config/environments/integration.rb
config.action_controller.session = {
:domain => ".exa开发者_JAVA百科mple.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
In Ruby on Rails 3 and above, you can access the config through Rails.application.config
In more recent versions, you can use Rails.configuration
instead. For example: Rails.configuration.time_zone
.
See more in the official manual on configuration
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]
精彩评论