This project is archived and is in readonly mode.
Named Scope respond_to? error coercing to array.
Reported by Tom Lea | August 18th, 2008 @ 05:53 PM | in 2.x
test_has_many_associations_have_access_to_named_scopes and test_has_many_through_associations_have_access_to_named_scopes from named_scope_test.rb were erroring as Array#& tried to coerce a Scope to an Array.
Was getting similar to the following:
test_has_many_through_associations_have_access_to_named_scopes(NamedScopeTest):
ArgumentError: wrong number of arguments (2 for 1)
./test/cases/../../lib/active_record/associations/association_proxy.rb:176:in `respond_to?'
./test/cases/../../lib/active_record/associations/association_proxy.rb:176:in `&'
./test/cases/../../lib/active_record/associations/association_proxy.rb:176:in `send'
./test/cases/../../lib/active_record/associations/association_proxy.rb:176:in `method_missing'
./test/cases/../../lib/active_record/associations/association_collection.rb:285:in `method_missing'
./test/cases/named_scope_test.rb:143:in `test_has_many_through_associations_have_access_to_named_scopes'
./test/cases/../../lib/../../activesupport/lib/active_support/testing/setup_and_teardown.rb:94:in `__send__'
./test/cases/../../lib/../../activesupport/lib/active_support/testing/setup_and_teardown.rb:94:in `run'
Self explanatory patch attached to fix this.
Comments and changes to this ticket
-
Tom Lea August 18th, 2008 @ 06:23 PM
This could be a Ruby version issue... I'm running...
ruby 1.8.7 (2008-06-20 patchlevel 22) [i686-darwin9]
Seems to be OK on 1.8.5 and 1.9... is anyone else seeing this?
Contrived none rails example of the behaviour:
class A def initialize(a) @a = a end def respond_to?(sym) super end def to_ary @a end end [1,2,3] & A.new([1,2,3,4]) # => # ~> -:15:in `respond_to?': wrong number of arguments (2 for 1) (ArgumentError) # ~> from -:15:in `&' # ~> from -:15
-
Repository August 21st, 2008 @ 04:41 PM
- State changed from new to resolved
(from [3724dafe71f4afb2ca9f4d7d2526b228aa6c05a3]) Fix incorrect signature for NamedScope#respond_to? [#852 state:resolved]
Signed-off-by: Pratik Naik pratiknaik@gmail.com http://github.com/rails/rails/co...
-
Repository August 25th, 2008 @ 09:31 AM
(from [76886789ac73f25744cd2eced5416918eab1bdc6]) Fix incorrect signature for NamedScope#respond_to? [#852 state:resolved]
Signed-off-by: Pratik Naik pratiknaik@gmail.com http://github.com/rails/rails/co...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Tags
Referenced by
- 852 Named Scope respond_to? error coercing to array. (from [3724dafe71f4afb2ca9f4d7d2526b228aa6c05a3]) Fix inc...
- 852 Named Scope respond_to? error coercing to array. (from [76886789ac73f25744cd2eced5416918eab1bdc6]) Fix inc...