Changing attributes in action
I am trying to simplify the commented out code by using
expr() , but i get an InvalidAttributeError with the hint string_downcase(nil)
Also I am not sure if to put it in before_action or not since from what I saw the change does not appear in the Phoenix form. So in both cases it should only appear in the database ?5 Replies
you don't have any arguments in the action just like the error states
maybe replace
^arg(:name) with name
Unfortunatly not
even when it is passed as an argument it fails with
value: string_downcase("Test") :/Solution
You can't use expressions in that context
You can do
atomic_update but that only works for update actions
I'd start with atomic_update and do a custom change if that wasn't sufficientokay, since I want to have it in the create action the custom change wil be the way to go.
Thanks 🙂