diff --git a/railties/lib/rails/engine/configuration.rb b/railties/lib/rails/engine/configuration.rb index 521ed95447..26b1a68b66 100644 --- a/railties/lib/rails/engine/configuration.rb +++ b/railties/lib/rails/engine/configuration.rb @@ -48,6 +48,33 @@ module Rails def autoload_paths @autoload_paths ||= paths.autoload_paths end + + def load_paths + ActiveSupport::Deprecation.warn "config.load_paths is deprecated. Please use config.autoload_paths instead." + autoload_paths + end + + def load_paths=(paths) + ActiveSupport::Deprecation.warn "config.load_paths= is deprecated. Please use config.autoload_paths instead." + self.autoload_paths = paths + end + + # Rails 3, by default, uses bundler, which shims the Kernel#gem method so that it should + # behave correctly for this deprecation. + def gem(name, options = {}) + super name, options[:version] || ">= 0" + require options[:lib] || name + rescue Gem::LoadError + msg = "config.gem is deprecated, and you tried to activate the '#{name}' gem using it.\n" + + if File.exist?("#{Rails.root}/Gemfile") + msg << "Please add '#{name}' to your Gemfile." + else + msg << "Please update your application to use bundler." + end + ActiveSupport::Deprecation.warn(msg, caller) + exit + end end end end