ash v1.6.5 Ash.Resource.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- The field on this resource that should match thedestination_fieldon the related resource. The default value is:id.:writable?- Whether or not the relationship may be edited. The default value istrue.