diff options
author | Jon Leighton <j@jonathanleighton.com> | 2012-01-27 01:28:54 -0800 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2012-01-27 09:31:48 +0000 |
commit | 1c5bd8a33dd7002c8664e587f968830c1bce3ff8 (patch) | |
tree | 3c95a6907e3c4e37bc1234e2ade5e5ac76d0980a /activerecord/lib | |
parent | 8e6ef371c59ebe8da7bc5f7fde7c221c2e651f39 (diff) | |
download | rails-1c5bd8a33dd7002c8664e587f968830c1bce3ff8.tar.gz rails-1c5bd8a33dd7002c8664e587f968830c1bce3ff8.tar.bz2 rails-1c5bd8a33dd7002c8664e587f968830c1bce3ff8.zip |
Merge pull request #4715 from pwim/find-create-multi-args
Fix regression from Rails 3.1
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/dynamic_matchers.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/dynamic_matchers.rb b/activerecord/lib/active_record/dynamic_matchers.rb index e9068089f0..b6b8e24436 100644 --- a/activerecord/lib/active_record/dynamic_matchers.rb +++ b/activerecord/lib/active_record/dynamic_matchers.rb @@ -25,7 +25,7 @@ module ActiveRecord if match = (DynamicFinderMatch.match(method_id) || DynamicScopeMatch.match(method_id)) attribute_names = match.attribute_names super unless all_attributes_exists?(attribute_names) - if arguments.size < attribute_names.size + if !(match.is_a?(DynamicFinderMatch) && match.instantiator? && arguments.first.is_a?(Hash)) && arguments.size < attribute_names.size method_trace = "#{__FILE__}:#{__LINE__}:in `#{method_id}'" backtrace = [method_trace] + caller raise ArgumentError, "wrong number of arguments (#{arguments.size} for #{attribute_names.size})", backtrace |