Ash Elixir

AE

Ash Elixir

Join the community to ask questions about Ash Elixir and get answers from other members.

Join

support

showcase

today-i-learned

Custom reset password flow not passing policy checks

I have a custom live view with a reset password form. ```elixir AshPhoenix.Form.for_read(User, :request_password_reset_with_password, api: Iterup.Users) |> to_form()...

About policies

It seems that policies are not triggered. I found this and tried but without success. https://discord.com/channels/711271361523351632/1079519120971812914 ```elixir...

Use a custom operator on FilterForm

Is it possible to expand FilterForm to allow other types of operators like using ilike or <% during filtering? I believe that this item will give a solution for that https://github.com/ash-project/ash/issues/374 but AFAIK this is not done yet. So, for now is there a workaround?...

How to create organization after user creation.

Ideally it would create organization for user after registration, but if user comes from invitation (to specific organization) than it does not create new one. No functionality is created yet, im not sure, how to even approach this. In user resource there isnt even actions for create. Apparently its definition happens somewhere in i suppose....

Adding macros to `expr/1`

I'd like to add the st_* macros from GeoPostGIS to expr/1, possibly more in future. These macros do generate exactly the fragment syntax that is currently supported by expr, which is pretty nice, but they don't work as-is. Is doesn't look like it's possible currently to extend Ash.Expr, and I'm quite interested in changing that, or at least making it possible to mix in external macros in this way using the existing supporting constructs like fragment. Has there been any interest/thought up to now on this topic?...

Adding a Notifier breaks elixir_sense autocompletions

I have recently added an ash Notifier to my project, and it has caused the elixir_sense plugin to throw an error when trying to show documentation. It is attempting to call .sections() on my notifier, but there is no spark DSL for notifiers. ```elixir [Error - 11:47:38] Request textDocument/completion failed. Message: an exception was raised:...

select relationship

Resource relevant parts ```elixir relationships do belongs_to :debit_account, Budget.Account, allow_nil?: false belongs_to :credit_account, Budget.Account, allow_nil?: false...

Mix ash_postgres.create problem

When I run mix ash_postgres.create on my project, I get the following error message in the terminal console: mix ash_postgres.create ** (Protocol.UndefinedError) protocol Enumerable not implemented for Bbg.Bids of type Atom (elixir 1.14.3) lib/enum.ex:1: Enumerable.impl_for!/1...

Users getting logged out every few hours

I recently switched our auth from phx.gen.auth to AshAuthentication. The switch was very smooth and users didn't notice anything except for one detail: they're now getting logged out every few hours (exact time seems to vary). I've been going through all documentation and the Discord but haven't found anything related. The only thing I found was this option token_lifetime, changing the value hasn't helped so far, though....

Show calculations in Ash Admin

Is there a way to show calculations in the Ash Admin panel for a particular Resource? My use-case is I have a file stored on Google Cloud Storage, and I want to show the signed url in the admin panel. The signed url has to be calculated every time since it expires...

Multiple checkbox group with Ash Forms

Is there a recommended guide to implementing something similar to the checkboxgroup component featured in https://fly.io/phoenix-files/making-a-checkboxgroup-input/ but compatible with Ash's form helpers? I've been working through that guide but it doesn't seem to play nice with the resources and forms I have. Been trying to munge my data into the right shape and now I'm wondering if there's an existing component system for this I'm overlooking (I've heard about Surface but I'm under the impress...

Best way to skip tenant check on a query

In my app I have users and accounts. The accounts are tenants. Users have and belong to many accounts through memberships. I've made the memberships resource multi-tenant, but now the users can't load their memberships. Memberships are really co-owned. Should I remove the multi-tenancy? Or is there a way for a query to ignore the tenant check?...

AshAdmin.PageLive.__live__/0 is undefined

Hello I'm very new to the framework. I was trying to use AshAdmin for one of my resource but I get the error in the image...
No description

Union relationships

Hello i have 2 resources. Accounts and Payments. Each payment has 2 relationships to accounts...

Use API access token to login into LiveView

Currently my system has two different ways to login, one is from our frontend which uses a GraphQL mutation to do the login and the other is via AshAuthentication LiveSession for LiveView. This means that for GraphQL I send the access token in the header as a Bearer authentication, but for LiveView, Phoenix will actually sign that same access token with the csrf and store that signature into a cookie called _marketplace_key. What I want to do is to make both system login process seamless, meaning that if the user is logged from the frontend (which uses the GraphQL api), it will also automatically be logged when the user go to the LiveView part of the system....

No Such Relationship

I have a many_to_many relationship between Plan and Post. Plan is the source, the relationship is defined there. Post is the destination. PlansPosts is the join resource. It's all in the same api this time. I'm making a form with, and calling manage_relationship from, Post, and that's resulting in a Spark error: ``` (EXIT from #PID<0.95.0>) an exception was raised: (Spark.Error.DslError) [Panacea.Sites.Post] actions -> create -> commander_create -> change -> manage_relationship -> relate_plans -> plans:...

`many_to_many` error

`` ** (RuntimeError) Resource SwiftEco.Resources.Accounts.UsersCompanies is not in registry SwiftEco.Resources.Companies for autogenerated join relationship: :users_join_assoc Relationship was generated by the many_to_many relationship :users` ...

After spark major update, deep preload not working.

Sorry for short description only. With spark 0.4.12, 2 or more depth preload is working fine, but with spark 1.1.4 only 1 depth preload works. i.e.) - resource A has one resource B...

Splitting resource using AshStateMachine using `Spark.Dsl.Fragment`

What I was hoping to do was be able to split my state_machine block from the rest of the resource using Spark.Dsl.Fragment. Bit of a catch-22 though, because without using the AshStateMachine extension there's notransition_state to use in actions, but with it there's no definition for initial_states. This hasn't been an issue for anything else, because for other extensions like AshGraphql, AshJsonApi, etc. there aren't the same kind of interdependencies and the rest of the stuff doesn't seem to get hung up because it's all in core. Is this a case worth addressing somehow? I can see there being more extensions in future that would, e.g. similarly provide additional changes builtins, but also have their own DSL section large enough to want to split it....

Filtering relationships in `relates_to_actor_via` etc.

Have a number of cases that I'm looking to set up policies and/or filters that perform a deep (but simple) join where for some path components it's necessary to filter the relationship. It's not feasible to create a different relationship for each possible filter, and I wanted to make sure that for right now I'm looking at doing the join manually in a custom check/filter. Generally would be interested in the current thought process for supporting parameterized relationships, and whether this is one of the target scenarios that's intended to be addressed. Related:...