2
我用的導軌3.1,formtastic 2.0.2和日期選擇器UI日期選擇器UI與formtastic,導軌3.1
我做datepicker_input.rb:
class DatepickerInput < Formtastic::Inputs::StringInput
include Formtastic::Inputs::Base
def input_html_options
super.merge(:class => "datepicker")
end
end
在application.js中我寫道:
$('input.datepicker').datepicker()
我在我的表單中使用它:as =>:datepicker。我看到日曆,選擇日期和一切都很好,除了它不填充我的模型中的列。我注意到的唯一事情是,當我填寫第一次日期,然後填寫所有其他字段 - 它的工作原理。當日期字段是最後一個 - 它不起作用。沒有錯誤,params [:model_name] [:date_field]不是空的,而是我選擇的日期位置。