Questions on Phoenix Context official Documentation

Some questions from a novice trying to learn Phoenix when performing the Contexts guide from the documentation.

After creating the relationship between Users and Credentials, with the appropriate add: user_id, references (: users, on_delete:: delete_all), null: false in credential.ex and has_one: credential, Credential in users.ex.

How do I insert / update data from iex()> , with the corresponding relation? Maybe I have a syntax problem?
After u5 = get_user! 5 I try:
update_user u5,% {name: "newname", "newemail"}
update_user u5,% {name: "newname", credential:% {email: "newemail"}}
Sorry for the silly question.
I do not know how to write correctly

Other question.
In the form show.eex, I get errors when I try to show them in the browser, if there are no Credentials in the database.
How to avoid it?

Thanks in advance.

Question solved with :
has_one(:credential, Credential , on_replace: :update)

and sintax is:
update_user u5,% {name: "newname", credential:% {email: "newemail"}}