From a5af3f75af86ff0abd9964bfd69483d116c12b13 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 22 Sep 2007 17:08:09 +0000 Subject: Added symbols as a legal way of specifying plugins in config.plugins (closes #9629) [tom] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7540 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- railties/lib/initializer.rb | 5 ++++- railties/lib/rails/plugin/loader.rb | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'railties/lib') diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb index 111b5237ba..3183b0a34a 100644 --- a/railties/lib/initializer.rb +++ b/railties/lib/initializer.rb @@ -429,7 +429,10 @@ module Rails # The list of plugins to load. If this is set to nil, all plugins will # be loaded. If this is set to [], no plugins will be loaded. Otherwise, # plugins will be loaded in the order specified. - attr_accessor :plugins + attr_reader :plugins + def plugins=(plugins) + @plugins = plugins.nil? ? nil : plugins.map { |p| p.to_sym } + end # The path to the root of the plugins directory. By default, it is in # vendor/plugins. diff --git a/railties/lib/rails/plugin/loader.rb b/railties/lib/rails/plugin/loader.rb index e935f9b34b..016bcc6c50 100644 --- a/railties/lib/rails/plugin/loader.rb +++ b/railties/lib/rails/plugin/loader.rb @@ -13,7 +13,7 @@ module Rails def initialize(initializer, directory) @initializer = initializer @directory = directory - @name = File.basename(directory) + @name = File.basename(directory).to_sym end def load @@ -126,7 +126,7 @@ module Rails end if !explicitly_enabled? && !other_plugin_loader.explicitly_enabled? - name <=> other_plugin_loader.name + name.to_s <=> other_plugin_loader.name.to_s elsif registered_plugins.include?(:all) && (!explicitly_enabled? || !other_plugin_loader.explicitly_enabled?) effective_index = explicitly_enabled? ? registered_plugins.index(name) : registered_plugins.index(:all) other_effective_index = other_plugin_loader.explicitly_enabled? ? @@ -138,7 +138,7 @@ module Rails end else - name <=> other_plugin_loader.name + name.to_s <=> other_plugin_loader.name.to_s end end end -- cgit v1.2.3