K
Kelly Felkins
------=_Part_6954_30644496.1123519056058
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
I would like to add some things to the find method of activerecord, but I=
=20
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
=20
and I get this:
kellyf@sb61g2:/var/www/rl-dev$ script/console
Loading development environment.
irb(main):001:0> t1 =3D 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/dep=
endencies.rb:189:in
`load'
from /usr/lib/ruby/gems/1.8/gems/activesupport-1.0.4/lib/active_support/dep=
endencies.rb:189:in
`load'
from /usr/lib/ruby/gems/1.8/gems/activesupport-1.0.4/lib/active_support/dep=
endencies.rb:38:in
`require_or_load'
from /usr/lib/ruby/gems/1.8/gems/activesupport-1.0.4/lib/active_support/dep=
endencies.rb:21:in
`depend_on'
from /usr/lib/ruby/gems/1.8/gems/activesupport-1.0.4/lib/active_support/dep=
endencies.rb:167:in
`require_dependency'
from /usr/lib/ruby/gems/1.8/gems/activesupport-1.0.4/lib/active_support/dep=
endencies.rb:167:in
`require_dependency'
from /usr/lib/ruby/gems/1.8/gems/activesupport-1.0.4/lib/active_support/dep=
endencies.rb:180:in
`const_missing'
from (irb):1
irb(main):002:0>=20
=20
Any suggestions?
------=_Part_6954_30644496.1123519056058--
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
I would like to add some things to the find method of activerecord, but I=
=20
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
=20
and I get this:
kellyf@sb61g2:/var/www/rl-dev$ script/console
Loading development environment.
irb(main):001:0> t1 =3D 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/dep=
endencies.rb:189:in
`load'
from /usr/lib/ruby/gems/1.8/gems/activesupport-1.0.4/lib/active_support/dep=
endencies.rb:189:in
`load'
from /usr/lib/ruby/gems/1.8/gems/activesupport-1.0.4/lib/active_support/dep=
endencies.rb:38:in
`require_or_load'
from /usr/lib/ruby/gems/1.8/gems/activesupport-1.0.4/lib/active_support/dep=
endencies.rb:21:in
`depend_on'
from /usr/lib/ruby/gems/1.8/gems/activesupport-1.0.4/lib/active_support/dep=
endencies.rb:167:in
`require_dependency'
from /usr/lib/ruby/gems/1.8/gems/activesupport-1.0.4/lib/active_support/dep=
endencies.rb:167:in
`require_dependency'
from /usr/lib/ruby/gems/1.8/gems/activesupport-1.0.4/lib/active_support/dep=
endencies.rb:180:in
`const_missing'
from (irb):1
irb(main):002:0>=20
=20
Any suggestions?
------=_Part_6954_30644496.1123519056058--