Sha256: 55f61dc733a9cc6ed90d9ac3f5ea65755f7ff5c9f9e69597d417d753fc8fdd29
Contents?: true
Size: 1.25 KB
Versions: 25
Compression:
Stored size: 1.25 KB
Contents
module Graphiti class Serializer < JSONAPI::Serializable::Resource include Graphiti::Extensions::BooleanAttribute include Graphiti::Extensions::ExtraAttribute include Graphiti::SerializableHash prepend Graphiti::SerializableTempId # Keep track of what attributes have been applied by the Resource, # via .attribute, and which have been applied by a custom serializer # class/file. # This way, we can ensure attributes NOT applied by a resource still # go through type checking/coercion class_attribute :attributes_applied_via_resource class_attribute :extra_attributes_applied_via_resource self.attributes_applied_via_resource = [] self.extra_attributes_applied_via_resource = [] def self.inherited(klass) super klass.class_eval do extend JSONAPI::Serializable::Resource::ConditionalFields end end # Temporary fix until fixed upstream # https://github.com/jsonapi-rb/jsonapi-serializable/pull/102 def requested_relationships(fields) @_relationships end # Allow access to resource methods def method_missing(id, *args, &blk) if @resource.respond_to?(id, true) @resource.send(id, *args, &blk) else super end end end end
Version data entries
25 entries across 25 versions & 1 rubygems