Ash Framework
The Elixir backend framework for unparalleled productivity. Declarative tools that let you stop wasting time. Use with Phoenix LiveView or build APIs in minutes for your front-end of choice.
JoinAsh Framework
The Elixir backend framework for unparalleled productivity. Declarative tools that let you stop wasting time. Use with Phoenix LiveView or build APIs in minutes for your front-end of choice.
JoinAshOban - no configuration for `domain`
Bypassing tenancy & authorization to load related data in special read
:bypass_all IIRCget_and_lock_for_update missing data
get_and_lock_for_update, then does an anonymous function change. It does this in order to do an array append into an {:array, :map} field.
```elixir...Adding new changeset arguments in `before_action`
Best option to read a relationship which has policy in Action
get_by_subject I added this:
```elixir
read :get_by_subject do...Aggregate first() generates seemingly inefficient subquery
Show live changes depending on nested data
Invoice resource that has_many InvoiceItems. Every InvoiceItem gets some data (quantity, tax_rate, unit_price) and calculates the item's total amounts in a change.
```elixir
Invoice Resource
change manage_relationship(:items, type: :create)...transform_params here. As far as I can understand it's helpful for updating the parameters that get passed to the form, but my "calculated" fields are not actually part of the form.
I was able to figure out another way – maybe it's helpful for someone else, so I'll share it. The solution was quite easy:
1) Run the necessary calculations in the top level changeset (also):...How to implement multi tenancy in user with unique email per site and global
Subscriptions return all data regardless of tenant
Following the guide in AshAi
function: :vector_cosine_distance, arity: nil, resource: Taleed.Poetry.Verse, could_be_calculation?: false, splode: Ash.Error, bread_crumbs: [\"Error returned from: Taleed.Poetry.Verse.vector_search\"], vars: [], path: [:filter], stacktrace: #Splode.Stacktrace<>, class: :invalid}" while retrieving Exception.message/1 for %Ash.Error.Query.NoSuchFunction{function: :vector_cosine_distance, arity: nil, resource: Taleed.Poetry.Verse, could_be_calculation?: false, splode: Ash.Error
function: :vector_cosine_distance, arity: nil, resource: Taleed.Poetry.Verse, could_be_calculation?: false, splode: Ash.Error, bread_crumbs: [\"Error returned from: Taleed.Poetry.Verse.vector_search\"], vars: [], path: [:filter], stacktrace: #Splode.Stacktrace<>, class: :invalid}" while retrieving Exception.message/1 for %Ash.Error.Query.NoSuchFunction{function: :vector_cosine_distance, arity: nil, resource: Taleed.Poetry.Verse, could_be_calculation?: false, splode: Ash.Error
Inconsistent behaviour between Ash.get and read actions, and Ash.load in context multitenancy (pg)
Many to many relationships and join tables in ash admin.

Igniter messes with sourceror
mix igniter.install ash_authentication --auth-strategy magic_link, however that fails after setting up igniter with:
```...How to show embedded resource in Ash Admin
Is there a guide for bringing Ash into an existing phx.gen.auth app?
Manually sign in a user in Phoenix
GenerateTokenChange and borrowing the magic link signin strategy I got my action to work
```diff
create :sign_up_with_invitation do
argument :token, :string, allow_nil?: false
...Deeply nested forms
Question on Multitenancy.
multitenancy macro and belongs to :organization to all resources?
2. I noticed we have functions like Ash.Query.set_tenant for read and Ash.Changeset.set_tenant for create. So I don't need to add something like change manage_relationship(:organization_id, :organization, type: :append) for create action?...How to pass `opts` to Repo module functions?
opts = [settings: [final: 1]]
Repo.get(User, id, opts)
opts = [settings: [final: 1]]
Repo.get(User, id, opts)
Adding new create action produces error in resource schema
Container, Image and ImageCredentials. Container has a belongs_to relationship with Image, Image has a has_many relationship with Container and a belongs_to relationship with ImageCredentials, while this last one has a has_many relationship with it.
Container has a create action (:create_with_nested), with the purpose of creating a new Image in case of a failed match or lookup. I'm fairly new to Ash, and I tried to add the same logic to Image if it cannot match or lookup a ImageCredentials by adding the following :create_with_nested action to Image:
```ex
create :create_with_nested do...