instance_method_already_implemented?

instance_method_already_implemented?(method_name)
Instance Public methods

Raises a 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 ActiveRecord

Person.instance_method_already_implemented?(:name)
# => false
doc_ruby_on_rails
2015-06-20 00:00:00
Comments
Leave a Comment

Please login to continue.