Ruby on rails 如何从应用程序控制器中读取RubyonRails配置值
如果我有这样一个配置文件Ruby on rails 如何从应用程序控制器中读取RubyonRails配置值,ruby-on-rails,ruby,configuration,Ruby On Rails,Ruby,Configuration,如果我有这样一个配置文件 # config/environments/integration.rb config.action_controller.session = { :domain => ".example.com" } 如何从应用程序控制器中获取值,例如: # app/controller/application_controller class ApplicationController < Mcc::CoreSupport::FrontendC
# config/environments/integration.rb
config.action_controller.session = {
:domain => ".example.com"
}
如何从应用程序控制器中获取值,例如:
# app/controller/application_controller
class ApplicationController < Mcc::CoreSupport::FrontendController
def some_method
value = xxx
end
end
#应用程序/控制器/应用程序#控制器
类ApplicationController
类方法ActionController::Base.session\u options
返回会话配置选项的哈希值
因此,如果您想要RubyonRails 3及更高版本中的
ActionController::Base.session\u options[:domain]
,您可以通过Rails访问配置。application.config
适用于Rails 5.1.1