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

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -