If i have a configuration file like this
如果我有这样的配置文件
# config/environments/integration.rb
config.action_controller.session = {
:domain => ".example.com"
}
How do Ii 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 个解决方案
#1
7
The class method ActionController::Base.session_options
returns a hash of the configuration options for the session.
类方法ActionController :: Base.session_options返回会话配置选项的哈希值。
So in your case you want ActionController::Base.session_options[:domain]
所以在你的情况下你想要ActionController :: Base.session_options [:domain]
#2
51
In Ruby on Rails 3, you can access the config through Rails.application.config
在Ruby on Rails 3中,您可以通过Rails.application.config访问配置
#1
7
The class method ActionController::Base.session_options
returns a hash of the configuration options for the session.
类方法ActionController :: Base.session_options返回会话配置选项的哈希值。
So in your case you want ActionController::Base.session_options[:domain]
所以在你的情况下你想要ActionController :: Base.session_options [:domain]
#2
51
In Ruby on Rails 3, you can access the config through Rails.application.config
在Ruby on Rails 3中,您可以通过Rails.application.config访问配置