0
我在我的sqLite数据库中有属性starting_date(t.date:starting_date)的游戏。 我想知道有alreday开始,所以我用这个代码行的所有游戏:rails howto比较datetime?
Game.find :all,:conditions=>"starting_date <= #{Date.today}"
Game.find_by_sql("SELECT * FROM "games" WHERE (created_at < 2010-05-13)")
结果是nill,尽管我知道我有游戏之前已经开始像这样的:
#<Game id: 1, team_1_id: 2, team_2_id: 1, status: 2, team_1_points: nil, team_2_points: nil, starting_date: "2010-05-05", winner: 1, sport: "football", country: nil, league: "calcio", created_at: "2010-04-07 00:09:21", updated_at: "2010-05-13 00:57:19">
我在这做错了什么?