Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stop Rails form label from modifying text

I have the code below in one of my views but it always renders as Home page url. How can I stop it from changing the case?

    <%= f.label "Home Page URL" %><br />
like image 651
DudeGuySomethingTimes Avatar asked Jun 23 '11 18:06

DudeGuySomethingTimes


1 Answers

<%= f.label :home_page_url, "Home Page URL" %><br />

Silly, I know, but that'll do it.

The first parm after f.label should actually be the method of the object being edited, so you've probably got that wrong. I'm assuming the method (field name) is actually "home_page_url" in my rewrite above. The second parm, optional, will override Rails' default case-ing of the method name - that's where you want to put in your properly-cased label.

like image 185
Yardboy Avatar answered Nov 06 '22 07:11

Yardboy