谁能解释一下,当我的表中有数据时,为什么我的数据库查询返回空?
Event.all
返回
...
Event Load (0.3ms) SELECT "events".* FROM "events"
=> #<ActiveRecord::Relation [#<Event id: 1, created_at: "2013-08-01 12:27:36", updated_at: "2013-08-01 12:27:36">
...
ETC,
尽管
Event.where(created_at: Date.today)
给我
Event Load (0.3ms) SELECT "events".* FROM "events" WHERE "events"."created_at" = '2013-08-01'
=> #<ActiveRecord::Relation []>
一切都在哪里?