Ash FrameworkAF
Ash Framework3y ago
33 replies
waseigo

Can a calculation use attributes of a related resource?

E.g., I have

belongs_to :brand, App.Portfolio.Brand

and

calculate :tagline, :string, expr(brand.name <> " — " <> name)

The result:

App.Portfolio.Family
|> Ash.Query.load(:brand)
|> Ash.Query.load(:tagline)
|> App.Portfolio.read!()
** (RuntimeError) Error while building reference: brand.name
Was this page helpful?