I have a resource that contains as one of its attributes another resource that is an embedded one.
defmodule Pacman.Markets.Property.Contact do @moduledoc false use Ash.Resource, data_layer: :embedded attributes do attribute :full_address, :string do constraints max_length: 255 end endenddefmodule Pacman.Markets.Property do @moduledoc false use Ash.Resource, data_layer: AshPostgres.DataLayer attributes do alias Pacman.Markets.Property.Contact attribute :contact, Contact ... endend
defmodule Pacman.Markets.Property.Contact do @moduledoc false use Ash.Resource, data_layer: :embedded attributes do attribute :full_address, :string do constraints max_length: 255 end endenddefmodule Pacman.Markets.Property do @moduledoc false use Ash.Resource, data_layer: AshPostgres.DataLayer attributes do alias Pacman.Markets.Property.Contact attribute :contact, Contact ... endend
When I try to access one of the embedded resource fields, ash will fail when I run the read action:
read :my_action do filter expr(full_address == contact.full_address)end
read :my_action do filter expr(full_address == contact.full_address)end
The error message will be
"filter: Invalid reference contact.full_address at relationship_path [:contact]"
"filter: Invalid reference contact.full_address at relationship_path [:contact]"
The Elixir backend framework for unparalleled productivity. Declarative tools that let you stop wasting time. Use with Phoenix LiveView or build APIs in minutes for your front-end of choice.