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">
我在這做錯了什麼?