Class: Plucker::HasOne

Inherits:
Relationship show all
Defined in:
lib/plucker/has_one.rb

Instance Attribute Summary

Attributes inherited from Relationship

#block, #condition, #name, #options

Instance Method Summary collapse

Methods inherited from Relationship

#associated_object, #initialize, #should_include?

Constructor Details

This class inherits a constructor from Plucker::Relationship

Instance Method Details

#value(serializer) ⇒ Object



6
7
8
9
10
# File 'lib/plucker/has_one.rb', line 6

def value(serializer)
    relationship_object = self.associated_object(serializer)
    return nil if relationship_object.blank?
    relationship_serializer(serializer, relationship_object).new(relationship_object).serializable_hash
end