Permalink
Browse files

Initializer.run returns an application object

  • Loading branch information...
1 parent dfbd3b9 commit 968c994c3b45147a822816d926a37c582c66859f @josh josh committed Sep 26, 2009
Showing with 16 additions and 2 deletions.
  1. +0 −2 railties/lib/rails/application.rb
  2. +8 −0 railties/lib/rails/core.rb
  3. +8 −0 railties/lib/rails/initializer.rb
View
2 railties/lib/rails/application.rb
@@ -1,5 +1,3 @@
-require 'action_controller'
-
module Rails
class Application
def initialize
View
8 railties/lib/rails/core.rb
@@ -14,6 +14,14 @@ def configuration=(configuration)
@@configuration = configuration
end
+ def application
+ @@application
+ end
+
+ def application=(application)
+ @@application = application
+ end
+
def initialized?
@initialized || false
end
View
8 railties/lib/rails/initializer.rb
@@ -1,5 +1,6 @@
require "pathname"
+require 'rails/application'
require 'rails/railties_path'
require 'rails/version'
require 'rails/gem_dependency'
@@ -89,12 +90,15 @@ def run_initializer(initializer)
def run(initializer = nil)
Rails.configuration = Base.config = @config
+ Rails.application = nil
if initializer
run_initializer(initializer)
else
@initializers.each {|block| run_initializer(block) }
end
+
+ Rails.application
end
end
@@ -575,4 +579,8 @@ def self.run(initializer = nil, config = nil)
Rails::Generators.options.deep_merge! config.generators.options
end
end
+
+ Initializer.default.add :build_application do
+ Rails.application = Rails::Application.new
+ end
end

0 comments on commit 968c994

Please sign in to comment.