Hey people I’m new to ash. any ideas how i could do this would be really nice.
I have a table like this.

I want to create a read action something like:
Posts.read_translated(:some_locale)
This action would return the title/content as string from the json column, extra credit if it could default to some defined locale if the current locale is empty. here’s the resource code:
defmodule Octafest.Blog.Post do
use Ash.Resource,
data_layer: AshSqlite.DataLayer
sqlite do
table "posts"
repo Octafest.Repo
end
code_interface do
define_for Octafest.Blog
define :create, action: :create
define :read_all, action: :read
define :update, action: :update
define :destroy, action: :destroy
define :get_by_id, args: [:id], action: :by_id
end
actions do
defaults ~w(create read update destroy)a
read :by_id do
argument :id, :uuid, allow_nil?: false
get? true
filter expr(id == ^arg(:id))
end
read :translated do
argument :locale, :atom do
allow_nil? false
end
pagination offset?: true, countable: :by_default
end
end
attributes do
uuid_primary_key :id
attribute :title, Octafest.Shared.Translated
attribute :content, Octafest.Shared.Translated
end
end


















