I''m sorry -- sent this to the wrong list. ---------- Forwarded message ---------- From: Kelly Felkins <kelly.felkins-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Date: Aug 8, 2005 9:37 AM Subject: help me override ActiveRecord find? To: ruby-talk-X+L+6nJQZ58h9ZMKESR00Q@public.gmane.org I would like to add some things to the find method of activerecord, but I can''t figure out how to do this. I''ve tried various things. Here is one example: class Thing < ActiveRecord::Base alias_method "kellys_find", "find" def self.find(*args) print "doing find\n"; kellys_find(args) end end and I get this: kellyf@sb61g2:/var/www/rl-dev$ script/console Loading development environment. irb(main):001:0> t1 = Thing.find(2) NameError: undefined method `find'' for class `Thing'' from ./script/../config/..//app/models/thing.rb:12:in `alias_method'' from ./script/../config/..//app/models/thing.rb:12 from /usr/lib/ruby/gems/1.8/gems/activesupport-1.0.4/lib/active_support/dependencies.rb:189:in `load'' from /usr/lib/ruby/gems/1.8/gems/activesupport-1.0.4/lib/active_support/dependencies.rb:189:in `load'' from /usr/lib/ruby/gems/1.8/gems/activesupport-1.0.4/lib/active_support/dependencies.rb:38:in `require_or_load'' from /usr/lib/ruby/gems/1.8/gems/activesupport-1.0.4/lib/active_support/dependencies.rb:21:in `depend_on'' from /usr/lib/ruby/gems/1.8/gems/activesupport-1.0.4/lib/active_support/dependencies.rb:167:in `require_dependency'' from /usr/lib/ruby/gems/1.8/gems/activesupport-1.0.4/lib/active_support/dependencies.rb:167:in `require_dependency'' from /usr/lib/ruby/gems/1.8/gems/activesupport-1.0.4/lib/active_support/dependencies.rb:180:in `const_missing'' from (irb):1 irb(main):002:0> Any suggestions? _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails