Проблема в том, что rails / activerecord ожидают, что дата будет в формате ISO 'гггг-мм-дд'.Но это не удобный для пользователя формат
Самое простое, на мой взгляд, решение - использовать атрибут alt на датчике. По сути, показать формат даты, но отправить другой формат даты:
= f.text_field :your_date, id: "your_date", class: "hidden" // This is hidden
// This will show up
= text_field_tag "date[something_we_will_not_use]", f.object.your_date.strftime("%m/%d/%Y"),
class: "datepicker", 'data-alt-field' => '#your_date'
Инициализация Datepicker
$('.datepicker').each(function() {
var alt_field = $(this).attr('data-alt-field');
$this.datepicker({
dateFormat: "mm/dd/yy",
prevText: '<i class="fa fa-chevron-left"></i>',
nextText: '<i class="fa fa-chevron-right"></i>',
altField: alt_field, // This is the tag where the date will be filled
altFormat: "yy/mm/dd" // This is how the date will be posted to your controller
});
})