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:

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/
Successfully installed rails-2.1.0
1 gem installed

Any clue, on either problem?

Thanks,


Greg D.
http://destiney.com/

On Tue, Jun 24, 2008 at 11:53 AM, Greg D. [email protected] 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 :slight_smile:

jeremy

On Tue, Jun 24, 2008 at 1:53 PM, Greg D. [email protected] 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 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/