Ash FrameworkAF
Ash Framework3y ago
15 replies
Terry Lee

JsonB sorting within Resource.actions

I have a Resource with a jsonb column called metadata

How do I default sort by `metadata ->> 'CreatedDate'?

actions do
    read :read do
      prepare build(sort: [expr(fragment("metadata->>'CreatedTime' DESC"))])   # <-- How do I do this?!
      filter expr(isproject == true)
    end
  end
Was this page helpful?