miguels
AEAsh Elixir
•Created by miguels on 9/27/2023 in #support
Persist embedded resources as :text instead of :map
Ok thanks for the help
13 replies
AEAsh Elixir
•Created by miguels on 9/27/2023 in #support
Persist embedded resources as :text instead of :map
Don't have a strong reason. Thought the standard string representation would be easier to store than a complex struct.
13 replies
AEAsh Elixir
•Created by miguels on 9/27/2023 in #support
Persist embedded resources as :text instead of :map
I tried defining a custom type but got very stuck when generating the APIs 😅
Ideally what I'd like to achieve is:
1. Have a nicely typed API in LV forms and GraphQL
2. Define an attribute on my resource that is a Cocktail.Schedule struct
3. Persist this Cocktail.Schedule struct as a string in the db (using the
to_i_calendar
function)
So far I can get the nice API using an embedded resource and I can do the casting and parsing with a custom type but I haven't found the way to tie it all together13 replies
AEAsh Elixir
•Created by miguels on 9/27/2023 in #support
Persist embedded resources as :text instead of :map
I was looking to store the schedule as standard iCalendar RRULE for example
"DTSTART:20230622T000000\nRRULE:FREQ=WEEKLY;INTERVAL=2"
13 replies
AEAsh Elixir
•Created by miguels on 5/3/2023 in #support
Users getting logged out every few hours
Managed to add a remember me cookie to the app.
Let's see if I can turn it into an add on for AshAuth, any pointers how to get started?
8 replies
AEAsh Elixir
•Created by miguels on 5/3/2023 in #support
Users getting logged out every few hours
Oh ok it's just the lack of "remember me" cookie 🤣
That explains why users getting logged out after different amounts of time...
8 replies
AEAsh Elixir
•Created by miguels on 5/3/2023 in #support
Users getting logged out every few hours
Some extra details:
- It's a LiveView app
- We're only using the password strategy
8 replies
AEAsh Elixir
•Created by miguels on 4/23/2023 in #support
How to create has_one relationships in a nested form
This also taught me things I didn't know about Ash
42 replies
AEAsh Elixir
•Created by miguels on 4/23/2023 in #support
How to create has_one relationships in a nested form
Thanks a lot for taking the time
42 replies
AEAsh Elixir
•Created by miguels on 4/23/2023 in #support
How to create has_one relationships in a nested form
Tests are passing 🎉
42 replies
AEAsh Elixir
•Created by miguels on 4/23/2023 in #support
How to create has_one relationships in a nested form
Now I feel bad for making you work during your vacation 😅
42 replies
AEAsh Elixir
•Created by miguels on 4/23/2023 in #support
How to create has_one relationships in a nested form
Sorry still seeing the same error
42 replies
AEAsh Elixir
•Created by miguels on 4/23/2023 in #support
How to create has_one relationships in a nested form
Still seeing the error on the main branch with
attribute_writable? true
42 replies
AEAsh Elixir
•Created by miguels on 4/23/2023 in #support
How to create has_one relationships in a nested form
I might have been wasting your time 😅
Downgraded back to
{:ash, "~> 2.7"}
and also tried removing attribute_writable? true
from the relationship and it works.42 replies
AEAsh Elixir
•Created by miguels on 4/23/2023 in #support
How to create has_one relationships in a nested form
Oh but if I remove
attribute_writable? true
from the relationship it works!
Tried it because I spotted private_and_belongs_to?
in the commit.42 replies
AEAsh Elixir
•Created by miguels on 4/23/2023 in #support
How to create has_one relationships in a nested form
Hi @Zach Daniel thanks for the update
Tried with
{:ash, github: "ash-project/ash", branch: "main", override: true}
but still getting the same error.42 replies
AEAsh Elixir
•Created by miguels on 4/23/2023 in #support
How to create has_one relationships in a nested form
It looks like the issue really is setting the
transaction_id
as the primary key (and therefore also allow_nil? false
)
If I add integer_primary_key :id
to the attributes and remove primary_key? true
and allow_nil? false
from the transaction relationship the form passes validation and correctly saves all resources.
I'd like to keep the table structure as it is if possible, is there a way to tell the form/changeset to not validate the transaction_id
?
I could also use the :create
action directly, but that doesn't sound right.42 replies
AEAsh Elixir
•Created by miguels on 4/23/2023 in #support
How to create has_one relationships in a nested form
Tried downgrading to these versions and getting the same error there
42 replies
AEAsh Elixir
•Created by miguels on 4/23/2023 in #support
How to create has_one relationships in a nested form
It did work last week and stopped working. I changed a lot of stuff so not sure where I broke it. I believe maybe after upgrading Phoenix, LV/Surface and Ash to the latest version
42 replies
AEAsh Elixir
•Created by miguels on 4/23/2023 in #support
How to create has_one relationships in a nested form
I guess the missing
transaction_id
is just failing the form validation but the action can do it's job fine. When I add a random transaction_id
to the recurrence pattern form it actually works and even sets the correct id
42 replies