require 'active_model_serializers' module Mks module Rate class ApplicationRecord < ActiveRecord::Base self.abstract_class = true def json(data = nil) if data.nil? ActiveModelSerializers::SerializableResource.new(self).as_json else ActiveModelSerializers::SerializableResource.new(data).as_json end end def self.json(data) ActiveModelSerializers::SerializableResource.new(data).as_json end end end end