Browse files

OrderedOptions must implement respond_to? if it implements method_mis…

…sing.
  • Loading branch information...
1 parent f63f0ba commit 266b80c7b28c7587ab1c75aae6e3288e2f6c1aba @chriseppstein chriseppstein committed Jun 13, 2011
Showing with 7 additions and 9 deletions.
  1. +4 −0 activesupport/lib/active_support/ordered_options.rb
  2. +3 −9 railties/lib/rails/engine.rb
View
4 activesupport/lib/active_support/ordered_options.rb
@@ -36,6 +36,10 @@ def method_missing(name, *args)
self[name]
end
end
+
+ def respond_to?(name)
+ true
+ end
end
class InheritableOptions < OrderedOptions
View
12 railties/lib/rails/engine.rb
@@ -538,15 +538,9 @@ def load_seed
end
initializer :append_assets_path do |app|
- if app.config.assets.respond_to?(:prepend_path)
- app.config.assets.prepend_path(*paths["vendor/assets"].existent)
- app.config.assets.prepend_path(*paths["lib/assets"].existent)
- app.config.assets.prepend_path(*paths["app/assets"].existent)
- else
- app.config.assets.paths.unshift(*paths["vendor/assets"].existent)
- app.config.assets.paths.unshift(*paths["lib/assets"].existent)
- app.config.assets.paths.unshift(*paths["app/assets"].existent)
- end
+ app.config.assets.paths.unshift(*paths["vendor/assets"].existent)
+ app.config.assets.paths.unshift(*paths["lib/assets"].existent)
+ app.config.assets.paths.unshift(*paths["app/assets"].existent)
end
initializer :prepend_helpers_path do |app|

3 comments on commit 266b80c

@arunagw
Ruby on Rails member

Adding respond_to? breaks ActiveSupport::Configurable tests.

@josevalim
Ruby on Rails member

We should also have added a unit test to this change.

@chriseppstein

It's not clear to me what test to write. This class violated a contract. Do we need a test case that tests all classes that implement method missing?

Please sign in to comment.