I have tried several things in the last few hours - including branching, ripping out all the files, and adding the code back one bit at a time. I am really out of choices now - one interesting thing - this error seems to occur only on the rails app codepath. When I call the same function from a unit test, it works fine.
I did suspect that this was due to some gem being out of sync, as several articles suggested, so I have removed everything except uri, open-uri and nokogiri. It still does repro. Can someone please advise- at this point, any suggestion is useful. Thanks Anand On Jun 23, 9:20 pm, candor <rcan...@gmail.com> wrote: > Hi, > > I have a rails (2.3.5) project that has two models that are not > ActiveRecord based - one is called Wiki and another is called WebApi. > > I have been using this in the past, and it was working. However, > something I did is now causing ArgumentError to be raised when I call > a class method on WebApi from a Wiki class method. Here is the > relevant code: > > wiki.rb > > class Wiki > def self.get_url phrase='' > response = WebApi.format_and_call(WIKIPEDIA_URL, phrase) #error > occurs here > ... > end > ... > end > > web_api.rb > > class WebApi > def self.format_and_call url_format_string, phrase) > ... > end > end > > Here is the error I get: > > ArgumentError (wrong number of arguments (0 for 1)): > app/models/wiki.rb:7:in `get_url' > > On debugging, i notice that the error is coming from a const_missing > triggered by the attempt to access the WebApi object (it has nothing > to do with the Wikipedia Url constant, which is fine). Here is the > debug session: > > /(rdb:18) step > /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ > gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb: > 91 > if [Object, Kernel].include?(self) || parent == self > (rdb:18) step > /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ > gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/module/ > introspection.rb:31 > parent_name ? parent_name.constantize : Object > (rdb:18) step > /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ > gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/module/ > introspection.rb:8 > unless defined? @parent_name > (rdb:18) next > /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ > gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/module/ > introspection.rb:9 > @parent_name = name =~ /::[^:]+\Z/ ? $`.freeze : nil > (rdb:18) next > /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ > gems/1.8/gems/actionpack-2.3.5/lib/action_controller/rescue.rb:162 > rescue_action(exception) > (rdb:18) exception > #<ArgumentError: wrong number of arguments (0 for 1)> > > I had initially named the WebApi class as Web, and thought the problem > may be due to a name collision, but I tried different names, and get > the same problem. > > I am quite confused, since this seems fairly simple code, and I don't > know where to look. > > I am using devise, and have delayed_job as well in the project, but > not really using it in this case. > > Thanks > Anand -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.