module ActiveFedora::AttributeMethods::ClassMethods
def instance_method_already_implemented?(method_name)
Person.instance_method_already_implemented?(:name)
# => ActiveFedora::DangerousAttributeError: save is defined by Active Record. Check to make sure that you don't have an attribute or method with the same name.
Person.instance_method_already_implemented?(:save)
end
end
'already defined by Active Fedora'
def save
class Person < ActiveRecord::Base
\Active \Record method is defined in the model, otherwise +false+.
Raises an ActiveFedora::DangerousAttributeError exception when an
def instance_method_already_implemented?(method_name) raise DangerousAttributeError, "#{method_name} is defined by Active Fedora. Check to make sure that you don't have an attribute or method with the same name." if dangerous_attribute_method?(method_name) if superclass == Base super else # If ThisClass < ... < SomeSuperClass < ... < Base and SomeSuperClass # defines its own attribute method, then we don't want to overwrite that. defined = method_defined_within?(method_name, superclass, Base) && !superclass.instance_method(method_name).owner.is_a?(GeneratedAttributeMethods) defined || super end end