我在Ruby on rails(cloud9)上创建一个Web应用程序
我有一个用户的请假选项
date_leave
和date_return
假期管制员:
require 'date'
假期_form.html.err:
<%= f.label :date_leave %><br>
<%= f.date_select("date_leave", order: [:day,:month,:year]) %>
<%= f.label :date_return %><br>
<%= f.date_select("date_return", order: [:day,:month,:year]) %>
列出日期:
{1=>2015, 2=>9, 3=>20} {1=>2015, 2=>10, 3=>18}
如果我尝试编辑,我会收到此错误:
undefined method `year' for "{1=>2015, 2=>9, 3=>20}":String
有关此问题的任何想法吗?
class CreateHolidays < ActiveRecord::Migration
def change
create_table :holidays do |t|
t.string :booking_Id
t.string :Employee_number
t.string :leave_Request_Type
t.string :date_leave
t.string :date_return
t.integer :total_days
t.timestamps null: false
end
end
end
def update
respond_to do |format|
if @holiday.update(holiday_params)
format.html { redirect_to @holiday, notice: 'Leave request was successfully updated.' }
format.json { render :show, status: :ok, location: @holiday }
else
format.html { render :edit }
format.json { render json: @holiday.errors, status: :unprocessable_entity }
end
end
end