diff options
-rw-r--r-- | railties/lib/rails.rb | 6 | ||||
-rw-r--r-- | railties/lib/rails/application.rb | 4 | ||||
-rw-r--r-- | railties/test/application/loading_test.rb | 10 |
3 files changed, 15 insertions, 5 deletions
diff --git a/railties/lib/rails.rb b/railties/lib/rails.rb index 77a09507a8..6b431d3ee3 100644 --- a/railties/lib/rails.rb +++ b/railties/lib/rails.rb @@ -42,11 +42,7 @@ module Rails end def initialized? - @@initialized || false - end - - def initialized=(initialized) - @@initialized ||= initialized + application.initialized? end def logger diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index d7b8350963..fcb981bb9a 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -134,6 +134,10 @@ module Rails self end + def initialized? + @initialized + end + # Load the application and its railties tasks and invoke the registered hooks. # Check <tt>Rails::Railtie.rake_tasks</tt> for more info. def load_tasks(app=self) diff --git a/railties/test/application/loading_test.rb b/railties/test/application/loading_test.rb index 9302443c98..92951e1676 100644 --- a/railties/test/application/loading_test.rb +++ b/railties/test/application/loading_test.rb @@ -285,6 +285,16 @@ class LoadingTest < ActiveSupport::TestCase assert_equal 'OK', last_response.body end + def test_initialize_can_be_called_at_any_time + require "#{app_path}/config/application" + + assert !Rails.initialized? + assert !AppTemplate::Application.initialized? + Rails.initialize! + assert Rails.initialized? + assert AppTemplate::Application.initialized? + end + protected def setup_ar! |