ActiveRecord DangerousAttributeError: changed? is defined by ActiveRecord

18th October 2011 – 103 words
ActiveRecord::DangerousAttributeError: changed?

Columns named changed or valid causes this exception. To change that:

class Node < ActiveRecord::Base
  def self.instance_method_already_implemented?(method_name)
    return true if method_name == 'changed'
    return true if method_name == 'changed?'
    super
  end

end

But note, that this will influence the functionality of ActiveRecord (without changed? the API can’t distinguish, if the model was changed or is valid etc.).


Reposted from notes.it-jobs-und-stellen.de