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?