ash v0.6.3 Ash.Dsl.HasOne View Source
Link to this section Summary
Functions
Declares a has_one relationship. In a relationsal database, the foreign key would be on the other table.
Link to this section Functions
Declares a has_one relationship. In a relationsal database, the foreign key would be on the other table.
Generally speaking, a has_one also implies that the destination table is unique on that foreign key.
Examples
# In a resource called `Word`
has_one :dictionary_entry, DictionaryEntry,
source_field: :text,
destination_field: :word_text
Arguments
:name- The name of the relationship:destination- The destination resource
Options
:destination_field- Required. The field on the related resource that should match thesource_fieldon this resource.:source_field- false The field on this resource that should match thedestination_fieldon the related resource. The default value is:id.:reverse_relationship- A requirement for side loading data. Must be the name of an inverse relationship on the destination resource.