我有一个应用程序,用于为许多员工计划工作班次。我有一个Shift模型,我将shiftstart和存储shiftend为Time对象。
我Shifts在一个页面上显示用户,该页面在表格中显示了几天。这个想法是用户可以使用Best In Place gem直接在此表中编辑shiftstart和。shiftend
但是在处理 Time 对象时,我似乎无法弄清楚如何让它工作——任何人都对此有一些经验或建议。
我有以下代码:
看法:
<% @myShifts.where(:shiftdate => date).order(:shiftstart).each do |shift| %>
  <div class="shift-item span">
    <div class="hider">
      <p>
        <i class="icon gear"></i>
          <%= best_in_place shift.shiftstart.strftime("%H.%M"), :type => :input %> - <%= best_in_place shift.shiftend.strftime("%H.%M"), :type => :input %>
      </p>
    </div>
  </div>
<% end %>
架构:
create_table "shifts", :force => true do |t|
  t.time     "shiftstart"
  t.time     "shiftend"
  t.integer  "type_id"
  t.integer  "user_id"
  t.string   "note"
  t.datetime "created_at", :null => false
  t.datetime "updated_at", :null => false
  t.date     "shiftdate"
end
我收到“08.00”:String 错误的“未定义方法 `{:type=>:input}'并且我已经尝试将 Best In Place Type 切换到其他输入 - 没有帮助..