ash v0.10.0 Ash.Dsl.HasMany View Source

Link to this section Summary

Functions

Declares a has_many relationship. There can be any number of related entities.

Link to this section Functions

Link to this macro

has_many(name, destination, opts \\ [])

View Source (macro)

Declares a has_many relationship. There can be any number of related entities.

Examples

# In a resource called `Word`
has_many :definitions, DictionaryDefinition,
  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 the source_field on this resource.

  • :source_field - false The field on this resource that should match the destination_field on the related resource. The default value is :id.