Greg Donald
2008-Jun-24 18:53 UTC
wrong number of arguments (1 for 0) when using respond_to?
Trying to get an otherwise working app (in Rails 2.0.2) up to speed with Rails 2.1.0 and Ruby 1.8.7, I have some broken code I can''t seem to fix: module Pathmaker def self.append_features( base ) base.before_save do |model| model.path = model.name.downcase. gsub( /\ and\ /, ''-'' ). gsub( /\ on\ /, ''-'' ). gsub( /[^a-zA-Z0-9\-]/, ''-'' ). gsub( /[\-]+/, ''-'' ). gsub( /[\-]$/, '''' ). gsub( /^[\-]/, '''' ) if model.respond_to?( :path ) end end end class ActiveRecord::Base include Pathmaker end wrong number of arguments (1 for 0) /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/attribute_methods.rb:102:in `sum'' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/attribute_methods.rb:102:in `instance_method_already_implemented?'' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/attribute_methods.rb:72:in `define_attribute_methods'' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/attribute_methods.rb:71:in `each'' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/attribute_methods.rb:71:in `define_attribute_methods'' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/attribute_methods.rb:342:in `respond_to?'' /usr/local/apache2/rails/myapp/app/models/pathmaker.rb:11:in `append_features'' The online docs for respond_to? shows one required parameter, just like I''m doing: http://api.rubyonrails.org/classes/ActiveRecord/Base.html#M001338 So then I thought to check if Rails 2.1.0 has a different version of respond_to?. I tried to check my local rdocs, to be sure I was actually looking at version 2.1.0, but it seems Rails 2.1.0 didn''t building rdocs when I installed it, nor will it when I reinstall it:> sudo gem install rails -v=2.1.0Bulk updating Gem source index for: http://gems.rubyforge.org/ Successfully installed rails-2.1.0 1 gem installed Any clue, on either problem? Thanks, -- Greg Donald http://destiney.com/ --~--~---------~--~----~------------~-------~--~----~ 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jeremy Kemper
2008-Jun-24 19:02 UTC
Re: wrong number of arguments (1 for 0) when using respond_to?
On Tue, Jun 24, 2008 at 11:53 AM, Greg Donald <gdonald-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Trying to get an otherwise working app (in Rails 2.0.2) up to speed > with Rails 2.1.0 and Ruby 1.8.7, I have some broken code I can''t seem > to fix:Ruby 1.8.7 is not backward compatible with Ruby 1.8.6. Rails 2.1 is updated to work with the 1.8.7 changes; Rails 2.0.2 is not. Please use 1.8.6 :) jeremy --~--~---------~--~----~------------~-------~--~----~ 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Greg Donald
2008-Jun-25 16:22 UTC
Re: wrong number of arguments (1 for 0) when using respond_to?
On Tue, Jun 24, 2008 at 1:53 PM, Greg Donald <gdonald-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> but it seems Rails 2.1.0 didn''t > building rdocs when I installed it, nor will it when I reinstall it: > >> sudo gem install rails -v=2.1.0 > Bulk updating Gem source index for: http://gems.rubyforge.org/ > Successfully installed rails-2.1.0 > 1 gem installedI was finally able to get rdocs for Rails 2.1 to build once I upgraded my rubygem install to version 1.2. -- Greg Donald http://destiney.com/ --~--~---------~--~----~------------~-------~--~----~ 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---