How to read resource without actions
I'm trying to inspect
MyApp.Accounts.Token
using iex, but I'm getting NoPrimaryAction
error.
Is it possible to inspect resources without defining read action?
Is there a way to convert it to Ecto.Schema
, so I can use Ecto.Query
?
2 Replies
Hi there. There are actions generated by AshAuthentication but you can add your own also. Just add
And you’ll be good to go.
In answer to your other question - every Ash resource is an Ecto schema so you can just do
MyApp.Repo.all(MyApp.Accounts.Token)
every Ash resource is an Ecto schemaAwesome, this is what I was looking for. I just found an introspection tool to get a list of actions without reading
AshAuthentication
source code.
My problem can also be solved by adding action: :read