# Wrong number of arguments (1 for 0) when using respond\_to?

**URL:** <https://www.ruby-forum.com/t/wrong-number-of-arguments-1-for-0-when-using-respond-to/141338>\
**Category:** Rails\
**Created:** [June 24, 2008, 8:53pm UTC](https://www.ruby-forum.com/t/wrong-number-of-arguments-1-for-0-when-using-respond-to/141338 "2008-06-24T20:53:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![destiney](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f07891/32.png) [@destiney](https://www.ruby-forum.com/u/destiney)\
**Post date:** [June 24, 2008, 8:53pm UTC](https://www.ruby-forum.com/t/wrong-number-of-arguments-1-for-0-when-using-respond-to/141338/1 "2008-06-24T20:53:47Z")

</div>

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:

> **[ActiveRecord::Base](https://api.rubyonrails.org/classes/ActiveRecord/Base.html#M001338)**
>
> Active Record Active Record objects don't specify their attributes directly, but rather infer them from the table definition with which they're linked.

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.0  
> Bulk updating Gem source index for: [http://gems.rubyforge.org/](http://gems.rubyforge.org/)  
> Successfully installed rails-2.1.0  
> 1 gem installed

Any clue, on either problem?

Thanks,

–  
Greg D.  
[http://destiney.com/](http://destiney.com/)

---

<div class="post-metadata">

**Author:** ![destiney](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f07891/32.png) [@destiney](https://www.ruby-forum.com/u/destiney)\
**Post date:** [June 24, 2008, 9:03pm UTC](https://www.ruby-forum.com/t/wrong-number-of-arguments-1-for-0-when-using-respond-to/141338/2 "2008-06-24T21:03:45Z")

</div>

On Tue, Jun 24, 2008 at 11:53 AM, Greg D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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

---

<div class="post-metadata">

**Author:** ![destiney](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f07891/32.png) [@destiney](https://www.ruby-forum.com/u/destiney)\
**Post date:** [June 25, 2008, 6:23pm UTC](https://www.ruby-forum.com/t/wrong-number-of-arguments-1-for-0-when-using-respond-to/141338/3 "2008-06-25T18:23:28Z")

</div>

On Tue, Jun 24, 2008 at 1:53 PM, Greg D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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/](http://gems.rubyforge.org/)  
> > Successfully installed rails-2.1.0  
> > 1 gem installed

I was finally able to get rdocs for Rails 2.1 to build once I upgraded  
my rubygem install to version 1.2.

–  
Greg D.  
[http://destiney.com/](http://destiney.com/)
