how to have default value for a text field only for new form in rails? iam using :value => "0".but in edit form also iam getting ‘0’ value

how to have default value for a text field only for new form in rails? iam using :value => “0”.in form partial.but the problem is though i have a value in database, iam getting 0 in edit form. actually in new form for a text field iam assigning 0 by default, when the user not select any value. but when user changes that value and saves the form,then also while displaying edit form iam getting “0” value. how to avoid display of “0” when there is a value in database in edit form? this is the syntax iam using.
<%= f.text_field :duration , :size=>”4″, :value => “0” %>


Source: forms

Leave a Reply