I'm trying to save users the trouble of creating a username, so I am
generating it based on their email address. It doesn't need to be
unique, it is used in the view only, but that's not my question.
My question is how do I store it when the user fills out the form?
Obviously, this won't work, bc the user's email isn't saved yet...any
help you can provide? The line in ******* is the problem. Thank you.
I'm trying to save users the trouble of creating a username, so I am
generating it based on their email address. It doesn't need to be
unique, it is used in the view only, but that's not my question.
My question is how do I store it when the user fills out the form?
Obviously, this won't work, bc the user's email isn't saved yet...any
help you can provide? The line in ******* is the problem. Thank you.
Why do you need to put it into the form? Seems like this would be a good spot for a before_save handler in your user model. Check to see if the :username field is blank and if so, set it to the first bit of the email address...
Why do you need to put it into the form? Seems like this would be a
good spot for a before_save handler in your user model. Check to see
if the :username field is blank and if so, set it to the first bit of
the email address...