Rails datetime_local_field help not pre filling -
i have job model first_booking_time attribute. datetime_local_field form helper doesn't pre fill attribute stored on job instance.
# renders empty field though job.first_booking_time set <%= form_for @job |f| %> <%= f.datetime_local_field :first_booking_time %> <% end %> however, if use datetime_local_field_tag helper , pass in value, works:
# pre fills what's in job.first_booking_time <%= form_for @job |f| %> <%= datetime_local_field_tag 'job[first_booking_time]', @job.first_booking_time %> <% end %> how can use first syntax helper pre filling?
try below code
<%= f.datetime_local_field :first_booking_time , :value => @job.first_booking_time %>
Comments
Post a Comment