I need a field to populate a default value for a new record, but not on edit. I'm using haml and simple_form. This works, but feels inelegant. I'm sure there's a way to do this on a single line and avoid all the repetition but I don't know how to do the inline check for a new record?
- if @employee_expense.new_record?
#amount_field= f.input :amount, :input_html => {value: '0.00', :maxlength => 6}
- else
#amount_field= f.input :amount, :input_html => { :maxlength => 6}
Any thoughts?
@employee_expense.persisted?- aelor