set action argument in form
I have two resources: User and Account
I'm creating an AshFrom and use that to create an User. On submit, just before creating the User i need to create an account and pass it as argument to the action used in the
for_create
of the form.
Unfortunately i can't manage to find a way to set the argument in the form before it calls the action7 Replies
in the action i have something like this
While in the submit i have this
🤔 I might suggest making it a different action on the user that creates the account and the user
Unfortunately i tried using
before_action
and before_transaction
but its not working. Could the problem be caused by the fact that account is the resource that manages the multi tenancy in my app?That could be the reason, yes 🙂
what kind of error are you getting? I've had a similar type of action before
You might just need to set the tenant?
Might not work though, our "tenant is required" validation might cause problems
I remember what I did for this in the past. I had an action on the tenant resource that could also create a user
and then I created the user in an after_action hook on that action
unfortunately i can't manage to make it work. I know that probably there's something im missing on my side.
I have now changed the structure of the app to make an user unrelated to the account and now it's working.
Thanks a lot for all the info nonetheless ❤️
😭sorry it didn’t work out!
no worries 😄