"{error, E} -> {json, [{errors, *list_to_binary*(E)}]}" is correct only
when u have 1 error, otherwise it will crash
Why u can's simply use binary strings?
[{fun()->length(UserPassword)>7 end,<<"Password length must at least 8!
<br>">>},
{fun()->length(UserEmail)>5 end, <<"Invalid E-mail address! <br>">>},
{fun()->boss_db:find(user_record,[{user_email,'equals',string:to_lower(UserEmail)},{id,'not_in',[Id]}])==[]
end, <<"This e-mail address is already registered! <br>">>}].
P.S. I'm just curious, what id stands for?
On Monday, October 20, 2014 9:42:55 AM UTC+3, Alex V wrote:
>
>
>
> Hi everyone.
>
> Saw similar, but unanswered questions.
>
> When returning json from a controller, the browser often gets arrays
> instead of strings (even from tutorial examples, "greeting-N" always
> becomes an array) and vice versa. How do you control this behavior?
>
--
You received this message because you are subscribed to the Google Groups
"ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at http://groups.google.com/group/chicagoboss.
To view this discussion on the web visit
https://groups.google.com/d/msgid/chicagoboss/c3bb099e-098d-4ec2-abb0-9f392bb56faf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.