Hi,
I am new to the language and library and getting to know things by building an app. I’ve run into a problem where the following :content
attribute on the following Resource disappears when I try to type anything into the JSON editor input field in the ash_admin interface
Here is a video of the problem: issue_capture
In the terminal output I see the following. _target doesnt seem correct and im not sure if its a configuration issue on my end. It goes from content => undefined
[debug] HANDLE EVENT "validate" in AshAdmin.PageLive
Component: AshAdmin.Components.Resource.Form
Parameters: %{"_target" => ["form", "content"], "form" => %{"_form_type" => "update", "content" => "{\n \"asda\": \"aasg\"\n}", "id" => "cf8b8181-de34-4f09-a086-a3224fad5d38", "publish_from" => "2024-07-25T22:33", "publish_to" => "", "summary" => "Test summary", "title" => "asdasdasdada"}}
[debug] Replied in 287µs
[debug] HANDLE EVENT "validate" in AshAdmin.PageLive
Component: AshAdmin.Components.Resource.Form
Parameters: %{"_target" => ["undefined"], "form" => %{"_form_type" => "update", "content" => "{\n \"asda\": \"aasg\"\n}", "id" => "cf8b8181-de34-4f09-a086-a3224fad5d38", "publish_from" => "2024-07-25T22:33", "publish_to" => "", "summary" => "Test summary", "title" => "asdasdasdada"}}
defmodule ContentCove.Articles.Story do
use Ash.Resource,
otp_app: :content_cove,
domain: ContentCove.Articles,
data_layer: AshPostgres.DataLayer,
extensions: [AshAdmin.Resource]
postgres do
table "stories"
repo ContentCove.Repo
end
actions do
defaults [:read, :destroy]
default_accept [:title, :content, :summary, :publish_from, :publish_to]
create :create do
argument :tags, {:array, :uuid} do
allow_nil? true
end
change relate_actor(:created_by)
change relate_actor(:updated_by)
end
update :update do
require_atomic? false
argument :tags, {:array, :uuid} do
allow_nil? true
end
change relate_actor(:created_by)
change relate_actor(:updated_by)
change manage_relationship(:tags, type: :append_and_remove)
end
read :by_id do
argument :id, :uuid, allow_nil?: false
get? true
filter expr(id == ^arg(:id))
end
end
attributes do
uuid_primary_key :id
create_timestamp :inserted_at
update_timestamp :updated_at
attribute :summary, :string
attribute :publish_from, :utc_datetime do
allow_nil? false
end
attribute :publish_to, :utc_datetime
attribute :title, :string do
allow_nil? false
end
attribute :content, :map do
allow_nil? false
end
end
relationships do
belongs_to :created_by, ContentCove.Accounts.User do
allow_nil? false
end
belongs_to :updated_by, ContentCove.Accounts.User do
allow_nil? false
end
many_to_many :tags, ContentCove.Articles.Tag do
through ContentCove.Articles.StoryTag
source_attribute_on_join_resource :story_id
destination_attribute_on_join_resource :tag_id
end
end
end
The field is basically just meant to be one that accepts any valid JSON atm.
I have a feeling this has maybe got to do with some sort of validation issue on the field but not too sure. Any help would be appreciated
Thanks!