lib/graphiti/serializer.rb in graphiti-1.0.alpha.10 vs lib/graphiti/serializer.rb in graphiti-1.0.alpha.11
- old
+ new
@@ -3,9 +3,19 @@
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