user3064141
user3064141

Reputation: 407

How do I get Rails to use a custom string label for form

I have a User model that has a Name attribute, but I plan to use it more as a username. In the standard for label usage it has :name for the label, so Name shows up when the user sees the form. How can I force it to use a customer string "Username" label for this attribute in the form so that the :name attribute in the model actually contains the user's username. Thanks, Edward

Upvotes: 1

Views: 532

Answers (1)

random_user_0891
random_user_0891

Reputation: 2051

You just need to add it after the :name field like this

<%= form.label :name, "Username" %>

Upvotes: 1

Related Questions