jart
jart
AEAsh Elixir
Created by jart on 9/20/2023 in #support
Correct way to refer to actor in custom validation?
Should we be directly reaching into changeset.context.private.actor? Seems janky.
3 replies
AEAsh Elixir
Created by jart on 8/23/2023 in #support
Postgrex error when creating record with AshGeo type
I have a resource which contains an attribute defined as:
attribute :point, AshGeo.Geometry do
description "The underlying PostGIS geometry"
allow_nil? false
constraints geo_types: [Geo.PointZ]
private? true
end
attribute :point, AshGeo.Geometry do
description "The underlying PostGIS geometry"
allow_nil? false
constraints geo_types: [Geo.PointZ]
private? true
end
when I try and run a test which creates a record I get the following error:
** (Postgrex.QueryError) type `geometry` can not be handled by the types module Postgrex.DefaultTypes
** (Postgrex.QueryError) type `geometry` can not be handled by the types module Postgrex.DefaultTypes
I think this is to do with the Postgrex.Types.define added to the runtime.exs not being used in test?
12 replies
AEAsh Elixir
Created by jart on 7/6/2023 in #support
How best to model partial updates of optional attributes?
The classic example is a "user settings" page, where if they only change their username but leave the password field blank, you want to not update the password, but instead ignore it. The best I can come up with is something like this:
update :update do
change prevent_change(:password), where: [absent(:password)]
end
update :update do
change prevent_change(:password), where: [absent(:password)]
end
Is there a better way to achieve this?
5 replies
AEAsh Elixir
Created by jart on 5/28/2023 in #support
GraphQL: Disable filter generation for some read actions?
I am wiring up some AshAuthentication actions to a GraphQL API and I've noticed that it generates filter arguments for actions like signIn(email: String!, password: String!) which is nonsensical. I can see the derive_filter? boolean option for the whole resource, but is there a way to do it for a single query or mutation?
10 replies