0

Is there a way or is it possible to save in the database the value of the label tag?

<div class="field">
 <%= f.label :cust_name %><br />
 <div><label id="cust_name" name="delivery_receipt[cust_name]"></label>
 </div>
</div>
Gotchit
  • 25
  • 5
  • all is possible, but what exactly you want to do with labels? maybe you about http://stackoverflow.com/questions/1346939/rails-store-translations-in-database – Igor Guzak Sep 23 '14 at 07:54

1 Answers1

1

Typically you would have the label and the input field alongside each other:

<%= f.label :cust_name %>
<%= f.text_field :cust_name %>

This would display the label and an input field. The value entered by the user will be saved against cust_name in the DB.

Value of f.label

The value of f.label would simply be the symbol name (cust_name). This should be the name of one of your model attributes so generally you wouldn't want to save this to the DB.

Tom Kadwill
  • 1,448
  • 3
  • 15
  • 21