我已經安裝了以下寶石,並試圖實現日期選擇器。日期選擇器出現在字段中,但是當我選擇日期時,數據不會持續存在,甚至不會顯示在該字段中。我是否在使用我的coffeescript或html時犯了錯誤 - 或者這可能是寶石之間的不兼容?bootstrap-datepicker-rails - 選擇日期不會持久
gem 'bootstrap-sass'
gem 'bootstrap-datepicker-rails'
http://www.eyecon.ro/bootstrap-datepicker/
https://github.com/Nerian/bootstrap-datepicker-rails
articles.js.coffeescript
jQuery ->
$('#datepicker').datepicker()
dateFormat: 'yyyy-mm-dd'
weekStart: 0
autoclose: true
_form.html.erb
<div class="field" id="datepicker" data-date="current" >
<%= f.label :due %>
<%= f.text_field :due, 'data-behaviour' => 'datepicker' %>
</div>
這個回答幫助呢? – thewheelz