richaard0
AEAsh Elixir
•Created by richaard0 on 7/3/2023 in #support
Expected at most one result but got ...
I'm not sure if I've encountered a bug or not.
I have the following action:
and the following associated code interface:
I expect it to return at most one result.
In iex, if I call the following:
I receive the following error:
I confirmed that my record exists and that there is only one in my DB. More interestingly, here's the query that's being performed:
I only see a check for the tenant here (airline_id) and not the id of the flight.
Am I missing something super obvious in my resource or is this a bug?
Thanks a lot it in advance! 😀
5 replies
AEAsh Elixir
•Created by richaard0 on 5/14/2023 in #support
ResourceValidations error
I just updated a bunch of deps and something that worked fine before just doesn't right now.
I have the following error:
On my
User
resource, I have the following relationship:
It was my understanding that it should be fine if I specify which api
this belongs to, am I missing something?8 replies
AEAsh Elixir
•Created by richaard0 on 4/23/2023 in #support
Load relationships on inserted ressource
I was wondering if there was a way to load relationships by default on an inserted ressource after a successful submit of a
for_create
form?
The goal here is to simply append that newly inserted ressource to a list afterwards, but I need some relationships to be loaded on that ressource. I know I can do it manually, but I was wondering if there was a way to define some defaults "load" somewhere?
Thanks a lot in advance 🙂6 replies
AEAsh Elixir
•Created by richaard0 on 3/30/2023 in #support
AshPhoenix potential bug with relationships
I have the following form:
I do get an error if the
number
or plane
field is missing, but I don't have any errors for the departure
, arrival
and alternate
fields.
All 3 of these fields have a similar relationship on my resource that looks like this:
If I inspect the form, I don't see any errors at all regarding those fields, as if they weren't attributes at all, but I do see the attributes data:
attributes: %{alternate: nil, arrival: nil, departure: nil, number: nil},
Shouldn't the form show errors about those fields being required?14 replies
AEAsh Elixir
•Created by richaard0 on 3/21/2023 in #support
Multitenancy and no_attributes? relationship option
Reading through the docs, I encountered the part about the
no_attributes?
option while declaring relationships.
Reading this, I was under the impression that I wouldn't have to specify a belong_to
on my resource, but I encounter this error if I don't define one:
Am I missing something or do I still need to define a belong_to
for my Plane
resource?
For reference, my airline
resource has the following:
7 replies
AEAsh Elixir
•Created by richaard0 on 3/13/2023 in #support
Multitenancy and different Liveviews
So this might not be directly related to AshAuthentication, but somebody could help me figure out what's going.
I'm still super new to Elixir and Phoenix so bear with me haha
Continuing from the discussion above with multitenancy
I have a live_view being rendered normally from the router, but this one also has a child live_view rendered with live_render like so:
When I log in, I automatically gets logged out.
When I inspect the socket and session of the messaging live_view, on the second render, there aren't any users or tenant.
In messaging.ex, I have the following:
on_mount {MyAppWeb.UserAuth, :current_user}
which points to the following:
Is there anything I'm missing?
If I comment out the multitenancy part out, I don't encounter the isssue, same thing if I comment out the messaging live view
117 replies