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.
JoinHow do I do this SQL UPDATE-query in Ash?
UPDATE hats SET activation_token = null, activated = NOW() WHERE activation_token = ...
UPDATE hats SET activation_token = null, activated = NOW() WHERE activation_token = ...
Return resource A from an action on resource B
User resource and an Invitation resource. I would like to create an :accept_invitation action which validates an invitation record, creates a user, and returns the user. This is what I have attempted so far:
```elixir
on the invitation resource
update :create_user_with_invitation do...How to properly handle relationships and references
references do
reference :team, on_delete: :delete
reference :ticket, on_delete: :delete
end
references do
reference :team, on_delete: :delete
reference :ticket, on_delete: :delete
end
JSON API patch without bulk update
bulk_update? I'm wanting to write an update policy that's essentially a runtime policy (i.e. it needs access to the object that's changing in order to validate). Poking around source code though, it looks like PATCHes are always implemented with bulk updates?Conditional Relationship Creation
manage_relationship/4 with type: :direct_control and it does create the profile, but if the user already has one - with more data fulfilled - it overwrites it with the partial available data at user registration — which is not ideal.
Is manage_relationship/4 the right way to handle this? Or should I use an after_action hook to conditionally create the profile?...I found possible bug with Ash.DataLayer.Mnesia in form validation
How to implement an override table?
Manual relationship in belongs_to
belongs_to-like and some are has_*-like. And would love to preserve the semantics....How to concatenate strings on related column like STRING_AGG with sort?
has_many :parts, Part
has_many :parts, Part
Idiomatic way to test AshOban trigger conditions
Use full text search in fields
ash_oban discarded jobs with `trigger_no_longer_applies`
** (Oban.PerformError) MyApp.SomeDomain.SomeResource.AshOban.Worker.SomeTrigger failed with {:discard, :trigger_no_longer_applies}. It's quite odd because as far as I can tell, it seems like the jobs are running when I'd expect them to, however I see my oban jobs littered with many of these discarded jobs. I'm curious if this is something that is common/expected in ash_oban, or if it could potentially signal some deeper issue with my setup.
I've started observing some very strange timing bugs recently (the details of which I won't go into here) which are making me suspect these errors could be indicative of something wrong on a deeper level. I'm hoping to at least get a feel for how to interpret these errors, which I can then use to go debug the setup I have....Tenancy create schema concurrency errors on Tests
Is it possible to use LangChain.NativeTools?
In ash oban infer/bypass tenancy for action
multitenancy :bypass so it errors out with changesets require a tenant to be specified this also if I'm specifying a read action that bypasses the tenancy. What is the best practice here allow global true in the multitenancy block?...Using a relationship in a validation (atomicly)
How to use `after_action` when soft delete is enabled in global `Change`
Ash.destroy!(Ash.get!(MishkaCms.Runtime.Site, id)) it is not triggerd
It does not work
```elixir
defmodule MishkaCms.Runtime.Resources.Changes.SendToOban do...atomic callback depending on how you call your action and your atomic implementation isn't doing anything. But as your change only has an after_action and that's allowed in the context of atomics you can try this:
```elixir
defmodule MishkaCms.Runtime.Resources.Changes.SendToOban do
use Ash.Resource.Change...Drop unneeded column via codegen
office_id from my ParkingLot resource, replacing it with a belongs_to :site relationship. However, when I run mix ash.codegen, the migration generator is renaming the column instead of dropping the old one and creating a new one:
```
Like this instead of drop/add
rename table(:parking_lots), :office_id, to: :site_id...codegen. This removed the old column. Then I added the new relationships to the new table and ran codegen again. Worked perfect, and I kinda like that it forced me to make more granular migrations to drop and then create.Redirect on successful authentication
/sign-in.
3. They log in successfully....