[英]Rails and date_select
我正在嘗試將date_select與某些表單一起使用。
<div class="field">
<%= f.label :begin_date %>
<br/>
<%= f.date_select(:begin_date,:start_year => Time.now.year) %>
</div>
通讀文檔,我期望獲得三個選擇標簽。 我得到的是:begin_date(1i),begin_date(2i),begin_date(3i)
如果我將這些包括在模型中:
attr_accessible :begin_date(1i), :begin_date(2i), :begin_date(3i),
IDE不喜歡它。 我究竟做錯了什么? 另外,是否有一個日期選擇方法可以在單個標記中返回值,而不是3?
您只需執行attr_accessible :begin_date
,它將日期組件組合在一起,為您提供單個Date
值。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.