forms - rails create labels without changing format(capitalization) from database -


i think should pretty simple question, though can't seem find on it.

i have form includes bunch of fields dynamically generated list in database (using fields_for).

the labels each field in database: abc, doors, green dogs, abc, etc.

my problem label helper formats label capitalizing first word of each field: abc, doors, green dogs, abc, etc.

is there way can keep format database?

code:

<%= f.fields_for :dynamic |s|  %> <% s.label dyn.field_name %> 

you can as:

<%= s.label dyn.field_name, dyn.field_name %> 

and field_name preserved. second argument defines label text , can fancy operations on it:

<%= s.label dyn.field_name, "db field: #{dyn.field_name}" %> <%= s.label dyn.field_name, dyn.field_name.upcase %> 

Comments