aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorFranck Verrot <franck@verrot.fr>2011-07-11 11:05:26 +0200
committerFranck Verrot <franck@verrot.fr>2011-07-11 11:05:26 +0200
commitea649de669e14a57963113d13508152da2b6aafa (patch)
treea892695cc0b86302f4a9bb5310c6918ff5ccc1ca /railties
parentc3732bfed01de49947dd0aedd8cc976128b7f5db (diff)
downloadrails-ea649de669e14a57963113d13508152da2b6aafa.tar.gz
rails-ea649de669e14a57963113d13508152da2b6aafa.tar.bz2
rails-ea649de669e14a57963113d13508152da2b6aafa.zip
Rails.application#env_config is now public API. [Closes #1924]
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails/application.rb9
-rw-r--r--railties/test/application/configuration_test.rb9
2 files changed, 18 insertions, 0 deletions
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb
index fe29668c72..559739b2ec 100644
--- a/railties/lib/rails/application.rb
+++ b/railties/lib/rails/application.rb
@@ -106,6 +106,15 @@ module Rails
self
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
@env_config ||= super.merge({
"action_dispatch.parameter_filter" => config.filter_parameters,
diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb
index ff48817f96..448982f9de 100644
--- a/railties/test/application/configuration_test.rb
+++ b/railties/test/application/configuration_test.rb
@@ -516,5 +516,14 @@ module ApplicationTests
get "/", { :format => :xml }, "HTTP_ACCEPT" => "application/xml"
assert_equal 'XML', last_response.body
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