`:read`ing random entry
/api/quote
endpoint with :random
action which pretty much speaks for itself - returns a random quote and its author
how should i correctly define my :random
action? i know how to fetch a random entry using Ecto from q in "table", order_by: fragment("RANDOM()"), limit: 1, select: q
. how would i do this in my action? i am using sqlite btw and here's my resource definition
```elixir
use Ash.Resource,
domain: App.Domain,...prepare build(limit: 1, sort: Ash.Sort.expr_sort(fragment("RANDOM()")))
prepare build(limit: 1, sort: Ash.Sort.expr_sort(fragment("RANDOM()")))
Custom Authentication Flow with AshAuthentication in Phoenix + React (Inertia.js)
Is there a way to do a 'limit' on a relationship?
error with keyset pagination and random sort
Simple policy checks based with relationships
How to define custom sort?
Failing to create new user: Missing JWT signing secret
read action returning a boolean
Is there a plug for setting the tenant?
Joining this server encourages posting here :)
Forbid all but one field using field policies
status
. Basically it's needed for some calulcations but we don't want him to have access to any other data. So I've tried using policies like this:
```elixir
field_policies do
field_policy :status do
authorize_if always()...How to use Ash.Transform?
Ash.Query getting started docs
Persist embedded resources as :text instead of :map
Cocktail.Schedule.to_i_calendar/1
.
What I have so far:
I use an embedded schema to generate the API used in LV forms and GraphQL...Breaking action chain in a before_action?
:add
action with the upsert?
feature, and that works great for the Event persistence -- idempotent no-ops on subsequent calls....AshCsv calculations update
Ash.Query.load([:weighed_average])
) the entries would be written to the CSV file. That is not happening.
My question is, what is the right way of getting calculated values back into the file? (Or is this bad practice?)...Does attribute and action order matter? and Upsert fields?
Auth0 "Authentication Error" without any helpful details