Ash.Query.sort(:relationship_attribute) causes error

The following code used to work in Ash 2, but now returns an error in Ash 3. What’s the right way to do it? I can’t seem to find it in the Docs.

Resource2
|> Ash.Query.load([:resource1])
|> Ash.Query.sort([:resource1_name])

Error

 (Ecto.Query.CompileError) expected atom in field/2, got: `#first<resource1.resource1_name from #Ash.Query<resource: MyApp.MyDomain.Resource1, f

Resource modules:

Resource1
 attributes do
   attribute :resource1_name, :string
 ...

Resource2

  relationships do
    belongs_to :resource1, Resource1 
  ...

Can you upgrade ash_postgres as well?

1 Like

Certainly. Upgrading to 2.0.5 fixed the issue. Thank you!

1 Like