简体   繁体   中英

Rails and date_select

I am trying to use date_select with some of my forms.

<div class="field">
  <%= f.label :begin_date %>
  <br/>
  <%= f.date_select(:begin_date,:start_year => Time.now.year) %>
</div>

Reading through the documentation, I was expecting to get three select tags. What I got was: begin_date(1i), begin_date(2i), begin_date(3i)

If I include these in my model:

attr_accessible :begin_date(1i), :begin_date(2i), :begin_date(3i),

The IDE does not like it. What am I doing wrong? Also, is there a date select method that would return the values in a single tag, instead of 3?

您只需执行attr_accessible :begin_date ,它将日期组件组合在一起,为您提供单个Date值。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM