Class: JsonApiClient::Associations::HasOne::Association
- Inherits:
-
BaseAssociation
- Object
- BaseAssociation
- JsonApiClient::Associations::HasOne::Association
- Defined in:
- lib/json_api_client/associations/has_one.rb
Instance Attribute Summary
Attributes inherited from BaseAssociation
Instance Method Summary collapse
Methods inherited from BaseAssociation
#association_class, #data, #initialize
Constructor Details
This class inherits a constructor from JsonApiClient::Associations::BaseAssociation
Instance Method Details
#from_result_set(result_set) ⇒ Object
5 6 7 |
# File 'lib/json_api_client/associations/has_one.rb', line 5 def from_result_set(result_set) result_set.first end |
#load_records(data) ⇒ Object
9 10 11 12 |
# File 'lib/json_api_client/associations/has_one.rb', line 9 def load_records(data) record_class = Utils.compute_type(klass, data["type"].classify) record_class.load id: data["id"] end |