diff options
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/application.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails/engine.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails/initializable.rb | 5 |
3 files changed, 5 insertions, 4 deletions
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index 2e412147d3..cbb2d23238 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -91,7 +91,7 @@ module Rails @routes_reloader ||= RoutesReloader.new end - def initialize!(group=nil) + def initialize!(group=:default) raise "Application has been already initialized." if @initialized run_initializers(group, self) @initialized = true diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index 0e1e719596..2d25273050 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -542,7 +542,7 @@ module Rails require environment if environment end - initializer :append_assets_path, :group => :assets do |app| + initializer :append_assets_path, :group => :all do |app| app.config.assets.paths.unshift(*paths["vendor/assets"].existent_directories) app.config.assets.paths.unshift(*paths["lib/assets"].existent_directories) app.config.assets.paths.unshift(*paths["app/assets"].existent_directories) diff --git a/railties/lib/rails/initializable.rb b/railties/lib/rails/initializable.rb index 4c1da0a5a5..04d5b55c69 100644 --- a/railties/lib/rails/initializable.rb +++ b/railties/lib/rails/initializable.rb @@ -10,6 +10,7 @@ module Rails attr_reader :name, :block def initialize(name, context, options, &block) + options[:group] ||= :default @name, @context, @options, @block = name, context, options, block end @@ -48,10 +49,10 @@ module Rails end end - def run_initializers(group=nil, *args) + def run_initializers(group=:default, *args) return if instance_variable_defined?(:@ran) initializers.tsort.each do |initializer| - initializer.run(*args) if group.nil? || initializer.belongs_to?(group) + initializer.run(*args) if initializer.belongs_to?(group) end @ran = true end |