I want to trim blanks from certain inputs. For example, I’d like to silently remove leading and trailing blanks from a new account’s “human name” and “login name”, so as to avoid inserting values like these into the database:
%{
"auth_id" => " login id with blanks ",
"display_name" => " Dr. Dawn with leading and trailing blanks ",
"email" => "email@email.com",
(It’s nice that email_input strips blanks, though I wonder if I can depend on that, cross-browser.)
I could see using String.trim in the controller, or in a changeset, or possibly elsewhere. Is there a convention for where to do such things?
schema "users" do
field :auth_id, TrimmedString
field :display_name, TrimmedString
field :email, TrimmedString
field :active, :boolean, default: true
has_one :permission_list, PermissionList
...