20 lines
331 B
Ruby
20 lines
331 B
Ruby
# 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
|