Files
old-holivud2/app/models/concerns/syncable.rb

20 lines
331 B
Ruby
Raw Normal View History

2020-05-31 22:38:19 +02:00
# frozen_string_literal: true
module Syncable
extend ActiveSupport::Concern
def as_json(params = {})
json = super(params)
json.each do |key, value|
if key == "id"
json[key] = value.to_s
end
end
{
id: id.to_s,
type: model_name.param_key,
attributes: json
}
end
end