zin
2007-Mar-22 06:53 UTC
`alias_method_chain'': undefined method `find'' for class `ActiveRecord::Base'' (NameError)
I can''t seem to be able to override the :find method in the model base
class, for example, in /lib/usermonitor.rb:
module ActiveRecord
module UserMonitor
def self.included(base)
base.class_eval do
alias_method_chain :find, :user
def current_site
Thread.current[:user]
end
end
end
def find_with_user(*args)
...
end
end
end
I got this error:
`alias_method_chain'': undefined method `find'' for class
`ActiveRecord::Base'' (NameError)
However, overriding :create and :update methods work fine. Why?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Maybe Matching Threads
- alias_method_chain and Class methods (a Ruby question)
- undefined method `alias_method_chain' for I18n::Backend::Simple:Class
- undefined method ''alias_method_chain''
- validators.rb breaks after update from Rails 2.2.2 to 2.3.2
- alias_method_chain in Facebooker Causing Stack Level Too Deep
