Possible Duplicate:
How can I format the value shown in a Rails edit field?
all i’m pretty new with ruby on rails. I have a little problem. The format of a number. That number is a decimal one.
here is the view
<% has_error = f.object.errors.has_key? :amount %>
<div class="control-group<%= ' error' if has_error %>">
<%= f.label :amount, :class => 'control-label' %>
<div class="controls">
<%= f.text_field :amount, :class => 'text_field' %>
<%= content_tag(:span, f.object.errors[:amount].join(','), :class=> 'help-block') if has_error%>
</div>
</div>
That renders:
<input id="account_entry_amount" class="text_field" type="text" value="0.0" size="30" name="account_entry[amount]" maxlength="20" style="text-align: right;">
The value es “0.0” and i want it to be just “0”
Is there any way i can do that in a generic way? I don`t know, express that in a locale file, or initalizer?
Thanks you very much!
1 Answer