I know I can add new methods to models but I can't seem to overwrite an existing method. Here's what I have
In my User.rb
include ExtraMethods
def is_invisible?
true unless self.active?
end
In my module
module ExtraMethods
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def user_extra_methods
include ExtraMethods::InstanceMethods
end
end
module InstanceMethods
def is_invisible?
true unless self.active? || self.admin?
end
end
end
ActiveRecord::Base.send(:include, ExtraMethods)
User.send(:user_extra_methods)
What I want to happen is for the method in the plugin to override the method in the model. Any thoughts or references would be great, can't seem to find a good reference for this.
thanks!
J