Class: FastSerializer::JsonModel::HasOneRelationship
- Inherits:
-
Relationship
- Object
- Node
- Attribute
- Relationship
- FastSerializer::JsonModel::HasOneRelationship
- Defined in:
- lib/fast_serializer/json_model/has_one_relationship.rb
Instance Attribute Summary
Attributes inherited from Relationship
Attributes inherited from Attribute
#cond, #cond_arity, #cond_method_name, #context, #injected, #key, #method, #method_arity, #method_name, #mixin, #opts
Instance Method Summary collapse
Methods inherited from Relationship
#exclude?, #include?, #include_relation?, #included?, #initialize
Methods inherited from Attribute
#included?, #initialize, #inject, #injectable?
Methods inherited from Node
Constructor Details
This class inherits a constructor from FastSerializer::JsonModel::Relationship
Instance Method Details
#serialize(resource, params, _) ⇒ Hash
9 10 11 12 13 14 15 16 17 |
# File 'lib/fast_serializer/json_model/has_one_relationship.rb', line 9 def serialize(resource, params, _) relation = resource.public_send(method) if @serializer_klass @serializer_klass.new(relation, params).serializable_hash elsif @schema @schema.serialize_resource(relation, params) end end |