Using manage_relationship to delete a related record
type: :remove
option, Ash responds with Invalid value provided for notes: changes would create a new related record.
Is this the right approach? Or should I manually delete the record?Confused about `one_of` vs `attribute_equals`
:verify
action on a resource, which I only want to run on resources which have :role
set to :unverified
The below works as expected (produces valid/invalid changesets as expected):
```
update :verify do #custom action to verify an unverified user
validate attribute_equals(:role, :unverified) #only verify unverified users
change set_attribute(:role, :verified)...Calculatated fields and AshGraphQL
Bypass not applying - had to pass actor again in load
load!
call.
not sure if there's a better way to do this type of thing but this is what's working now:...AshJsonApi + Managed Relationships
Can You Add Additional Attributes to ash_authentication_phoenix?
role
attribute to my user resource so I did the below:
```
attributes do
uuid_primary_key :id
attribute :email, :ci_string, allow_nil?: false...How to determine if the current page is the last or first page in Keyset pagination
Full debug SQL
AshPostgres.DataLayer.run_aggregate_query/3, at: lib/data_layer.ex:738
A long enough sql would be truncated. How do I get the full sql without truncation?
Thanks!...Setting defaults for a form input that is an argument and not an attribute?
default
option for an action argument; however, It accepts a zero-argument function, so there's no way to get the resource being updated.
I explored using the prepare_params
option for AshPhoenix.Form.for_update
but I couldn't find any examples. It's arrity 2 and receives the params but is only called when the form is validated or submitted....How to make fields optional for graphql api?
hide_fields
is used, is there a way I can allow a field to be nil
for the Graphql API when it is not allowed to be nil
as an attribute?Understanding value_is_key option when managing relationships
many_to_many exception after updating Ash
2.6.31
. I updated to 2.11.8
today and an existing many_to_many
association that I had is now raising an exception. Did something change?
Here are my resources:
```elixir...How to programatically add a policy to a resource?
manage_relationship argument not relating primary key to resource
Calculations Using Relationships
:unread_count
calculation on the Channel
. It would take the current user as the actor and find the associated member of the channel, use that :last_read_at
time to filter down the messages associated with the channel to ones that has a :created_at
after that time, and count them.
I'm having a hard time figuring out how to do that based on the examples.
What I think I want is something like:...Ash Admin dependency for newest liveview
Because your app depends on ash_admin ~> 0.8.1 which depends on phoenix_live_view ~> 0.18.3, phoenix_live_view ~> 0.18.3 is required.
So, because your app depends on phoenix_live_view ~> 0.19.0, version solving failed.
Because your app depends on ash_admin ~> 0.8.1 which depends on phoenix_live_view ~> 0.18.3, phoenix_live_view ~> 0.18.3 is required.
So, because your app depends on phoenix_live_view ~> 0.19.0, version solving failed.
Ambiguous Call during Compile because of Extension
How not to select fields when loading a resource
How to put the same value at multiple places in a fragment?
fragment("SELECT my_custom_function(1/<rate>, 2/<rate>, 3*<rate>) FROM lookup_values WHERE id=<id>", rate, id)
?
Today, I will need to do fragment("SELECT my_custom_function(1/?, 2/?, 3*?) FROM lookup_values WHERE id=?", rate, rate, rate, id)
...