提交 871d7fad 编写于 作者: J José Valim

Merge pull request #1924 from cesario/1922-get-back-and-deprecate-env-default

Put back Rails.application#env_default and deprecate it [Closes #1922]
...@@ -106,6 +106,15 @@ def load_console(app=self) ...@@ -106,6 +106,15 @@ def load_console(app=self)
self self
end end
# Rails.application.env_config stores some of the Rails initial environment parameters.
# Currently stores:
#
# * action_dispatch.parameter_filter" => config.filter_parameters,
# * action_dispatch.secret_token" => config.secret_token,
# * action_dispatch.show_exceptions" => config.action_dispatch.show_exceptions
#
# These parameters will be used by middlewares and engines to configure themselves.
#
def env_config def env_config
@env_config ||= super.merge({ @env_config ||= super.merge({
"action_dispatch.parameter_filter" => config.filter_parameters, "action_dispatch.parameter_filter" => config.filter_parameters,
......
...@@ -516,5 +516,14 @@ def index ...@@ -516,5 +516,14 @@ def index
get "/", { :format => :xml }, "HTTP_ACCEPT" => "application/xml" get "/", { :format => :xml }, "HTTP_ACCEPT" => "application/xml"
assert_equal 'XML', last_response.body assert_equal 'XML', last_response.body
end end
test "Rails.application#env_config exists and include some existing parameters" do
make_basic_app
assert_respond_to app, :env_config
assert_equal app.env_config['action_dispatch.parameter_filter'], app.config.filter_parameters
assert_equal app.env_config['action_dispatch.secret_token'], app.config.secret_token
assert_equal app.env_config['action_dispatch.show_exceptions'], app.config.action_dispatch.show_exceptions
end
end end
end end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册