diff options
author | Carl Lerche <carllerche@mac.com> | 2009-09-29 17:33:17 -0700 |
---|---|---|
committer | Carl Lerche <carllerche@mac.com> | 2009-09-29 17:33:17 -0700 |
commit | c9d4529c9da7c8c8f1ba3c2ab55fb40154a25023 (patch) | |
tree | fd4e7f2189e0b26e413c15ff68f8df7e8da378ae /railties/lib/rails/initializer.rb | |
parent | d1a63b15e329a141e0e4cc3b01d6f348d1c25c0a (diff) | |
download | rails-c9d4529c9da7c8c8f1ba3c2ab55fb40154a25023.tar.gz rails-c9d4529c9da7c8c8f1ba3c2ab55fb40154a25023.tar.bz2 rails-c9d4529c9da7c8c8f1ba3c2ab55fb40154a25023.zip |
Change Rails::Application to a class that is inherited from.
This is still very experimental.
Diffstat (limited to 'railties/lib/rails/initializer.rb')
-rw-r--r-- | railties/lib/rails/initializer.rb | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/railties/lib/rails/initializer.rb b/railties/lib/rails/initializer.rb index 382838f831..ddd0bb89a3 100644 --- a/railties/lib/rails/initializer.rb +++ b/railties/lib/rails/initializer.rb @@ -30,7 +30,7 @@ module Rails end def config - @@config + @@config || Configuration.new end alias configuration config @@ -96,15 +96,6 @@ module Rails else @initializers.each {|block| run_initializer(block) } end - - # HAX - # TODO: remove hax - unless initializer - app = Rails::Application.new - app.config = @config - - Rails.application = app - end end end @@ -113,10 +104,16 @@ module Rails end def self.run(initializer = nil, config = nil) - default.config = config if config - default.config ||= Configuration.new - yield default.config if block_given? - default.run(initializer) + # TODO: Clean this all up + if initializer + default.config = config + default.run(initializer) + else + Rails.application = Class.new(Application) + yield Rails.application.config if block_given? + default.config = Rails.application.config + default.run + end end end |