Hi,
I want to add actio to the reason for picking first record from the database that matches as specific condition in a specific order. Something similar to laravel eloquent first function. Flight::first();
I want to be able to call Flight.first()
and get the first record in the table.
Here is what I tried to do with Ash but it is not working. It gives the error
** (Ash.Error.Invalid) Invalid Error
* No such field limit for resource Transports.Flight
at filter
defmodule Transports.Flight do
use Ash.Resource,
domain: Transports,
data_layer: AshPostgres.DataLayer
require Ash.Query
postgres do
table "flights"
repo Transports.Repo
end
actions do
defaults [:create, :read, :update, :destroy]
read :first do
limit: 1
end
end
end