aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/rails')
-rw-r--r--railties/lib/rails/application.rb2
-rw-r--r--railties/lib/rails/plugin.rb13
2 files changed, 10 insertions, 5 deletions
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb
index 2d0892282e..91c866d0c9 100644
--- a/railties/lib/rails/application.rb
+++ b/railties/lib/rails/application.rb
@@ -98,7 +98,7 @@ module Rails
def plugins
@plugins ||= begin
plugin_names = config.plugins || [:all]
- Plugin.plugins.select { |p| plugin_names.include?(:all) || plugin_names.include?(p.plugin_name) } +
+ Plugin.plugins.select { |p| plugin_names.include?(:all) || plugin_names.include?(p.plugin_name) }.map { |p| p.new } +
Plugin::Vendored.all(config.plugins || [:all], config.paths.vendor.plugins)
end
end
diff --git a/railties/lib/rails/plugin.rb b/railties/lib/rails/plugin.rb
index be6cdec3fa..b5e6953fef 100644
--- a/railties/lib/rails/plugin.rb
+++ b/railties/lib/rails/plugin.rb
@@ -27,12 +27,17 @@ module Rails
def self.rake_tasks(&blk)
@rake_tasks ||= []
- @rake_tasks << blk
+ @rake_tasks << blk if blk
+ @rake_tasks
end
- def self.load_tasks
- return unless @rake_tasks
- @rake_tasks.each { |blk| blk.call }
+ def rake_tasks
+ self.class.rake_tasks
+ end
+
+ def load_tasks
+ return unless rake_tasks
+ rake_tasks.each { |blk| blk.call }
end
# Creates an initializer which includes all given modules to the given class.