我试图找到“created_at”最新记录 - 数据库列类型是“日期时间”,我现在用的是UI的DatePicker jQuery的距离
我的网址是这样的: “本地主机:3000 / users_supported selected_date = 2012-10-31”
到目前为止,我在做什么好:)我在控制器查询如下所示:
@support_histories = current_agent.support_histories.where(:created_at => Date.parse(params[:selected_date]))
如何正确提取由只能从“日期时间”“日期”数据库列记录
我试图在Rails的控制台这样做,但没有运气:
sh = SupportHistory.where(:created_at => DateTime.parse('2012-10-31'))
sh = SupportHistory.where(:created_at => Date.parse('2012-10-31'))
sh = SupportHistory.where(:created_at => DateTime.strptime('2012-10-31', '%Y-%m-%d'))
我有记录,如果我喜欢下面提及,但因为我试图找到“日期”纪录由“日期时间”不是对我很有用不
sh = SupportHistory.where(:created_at => '2012-10-31 19:49:57')