method
instance_method_already_implemented?
Ruby on Rails latest stable (v7.1.3.2)
-
0 notes -
Class: ActiveRecord::AttributeMethods::ClassMethods
instance_method_already_implemented?(method_name)
public
Raises an ActiveRecord::DangerousAttributeError exception when an Active Record method is defined in the model, otherwise false.
class Person < ActiveRecord::Base def save 'already defined by Active Record' end end Person.instance_method_already_implemented?(:save) # => ActiveRecord::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?(:name) # => false