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.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 Donald
http://destiney.com/
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
I was finally able to get rdocs for Rails 2.1 to build once I upgraded
my rubygem install to version 1.2.