class ActiveModelSerializers::Model
def self.human_attribute_name(attr, _options = {})
The following methods are needed to be minimally implemented for ActiveModel::Errors
def self.human_attribute_name(attr, _options = {}) attr end
def self.lookup_ancestors
def self.lookup_ancestors [self] end
def cache_key
def cache_key attributes.fetch(:cache_key) { "#{self.class.name.downcase}/#{id}-#{updated_at.strftime('%Y%m%d%H%M%S%9N')}" } end
def id
def id attributes.fetch(:id) { self.class.name.downcase } end
def initialize(attributes = {})
def initialize(attributes = {}) @attributes = attributes && attributes.symbolize_keys @errors = ActiveModel::Errors.new(self) super end
def read_attribute_for_serialization(key)
def read_attribute_for_serialization(key) if key == :id || key == 'id' attributes.fetch(key) { id } else attributes[key] end end
def updated_at
def updated_at attributes.fetch(:updated_at) { File.mtime(__FILE__) } end