I’m working with Ash and AshJsonApi and encountering an issue with how article_id is being handled in the URL parameters for my comment resource.
actions do
create :add_comment do
accept [:comment, :article_id]
change set_attribute(:article_id, arg(:article_id))
end
My domain:
json_api do
routes do
base_route "/articles", Article do
base_route "/:article_id/add_comment", Comment do
post :add_comment
end
end
end
end
end
I intended to use change set_attribute(:article_id, arg(:article_id)) in the add_comment action of the comment resource to automatically set the article_id from the URL parameters, without having to include it in the request body. However, I’m encountering an error where it says invalid_body and required properties are missing: channel_id
How can I configure Ash to use the article_id from the URL parameters for the add_comment action?






















