I am planning to generate my users. I have a first_name column and one last column, when I submit the form, I want to be the first letter of the first name for the user name, as well as the last name.
first_name: Michael last_name: Hopkins username: mhopkins I am very new to rail and I am not sure where I keep this argument I am Can anyone help?
The easiest way to put it in your user (or appropriate) model
< Code> Beforehand: ready_username def prep_username self.user_name = (self.first_name [0] + self.last_name) .to_s.downcase end Note: Please make sure that you first first_name And last_name is not empty
No comments:
Post a Comment