Oh yes indeed. Thanks.
Edgar J. Suarez On Oct 16, 4:24 pm, Pratik <[EMAIL PROTECTED]> wrote: > Hey Edgar, > > Doeshttp://github.com/rails/rails/commit/95c609357e78106e9673931d3f60d8ff. .. > fix it for you ? > > Thanks. > > On Thu, Oct 16, 2008 at 11:03 PM, Edgar J. Suárez <[EMAIL PROTECTED]> wrote: > > > > > Sorry for the commit link, it is: > > >http://github.com/rails/rails/commit/517bc500ed95a84fd2aadff34fdc14cb... > > > / introduced the new method proxy_respond_to?... > > > Edgar J. Suarez > > > On Oct 16, 3:57 pm, "Edgar J. Suárez" <[EMAIL PROTECTED]> wrote: > > >> Commithttp:// github.com/rails/rails/commit/517bc500ed95a84fd2aadff34fdc14cb... > >> the new method proxy_respond_to?, but it has a bug. > > >> Suppose the following case (it's using will_paginate plugin) > > >> class User < ActiveRecord::Base > >> has_many :articles > >> end > > >> Then you call: > > >> u = User.first > >> u.articles # => [some articles...] > >> u.articles # => > >> ArgumentError: wrong number of arguments (2 for 1) > >> from > >> .../activerecord/lib/active_record/associations/association_proxy.rb:78:in > >> `proxy_respond_to?' > >> from > >> .../activerecord/lib/active_record/associations/association_proxy.rb:78:in > >> `respond_to?' > >> from > >> .../vendor/plugins/will_paginate/lib/will_paginate/finder.rb:155:in > >> `respond_to?' > >> from .../activerecord/lib/active_record/associations.rb:1287:in > >> `articles' > >> from (irb):3 > > >> As you can see, the bug is caused in the will_paginate plugin because it > >> pass two params to the super respond_to? > > >> def respond_to?(method, include_priv = false) #:nodoc: > >> case method.to_sym > >> when :paginate, :paginate_by_sql > >> true > >> else > >> super(method.to_s.sub(/^paginate/, 'find'), include_priv) > >> end > >> end > > >> So the fix should be adding an extra param to proxy_respond_to? > > >> def proxy_respond_to?(method, include_priv = false) > >> super || @reflection.klass.respond_to?(method, include_priv) > >> end > > >> How could I test this to submit a patch? > > >> PS: Even this is kinda curious because it throws the Exception after the > >> second time it's called, not the first one. Haven't gone that deep yet. > > >> Regards. > > >> Edgar J. Suarez > > -- > Cheers! > - Pratikhttp://m.onkey.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
