Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/55.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 比较heroku pgsql上的日期_Ruby On Rails_Ruby_Postgresql_Heroku_Ruby On Rails 4 - Fatal编程技术网

Ruby on rails 比较heroku pgsql上的日期

Ruby on rails 比较heroku pgsql上的日期,ruby-on-rails,ruby,postgresql,heroku,ruby-on-rails-4,Ruby On Rails,Ruby,Postgresql,Heroku,Ruby On Rails 4,我正在尝试选择开始日期在本周内的项目 Outproject.where('start_at > ? and start_at < ?', Time.now.at_beginning_of_week.to_time,(Time.now.at_beginning_of_week + 5.days).to_time) Outproject.where('start_at>?and start_at=?和start\u at)可能有助于您在heroku配置中添加时区。

我正在尝试选择开始日期在本周内的项目

Outproject.where('start_at > ? and start_at < ?', Time.now.at_beginning_of_week.to_time,(Time.now.at_beginning_of_week + 5.days).to_time)
Outproject.where('start_at>?and start_at<?',Time.now.at_beging_of u week.to_Time,(Time.now.at_beging_of u week+5.days.)to_Time)
这在本地运行没有问题(运行postgresql),但在heroku上它会给出一个空结果(即使它不应该)

我试过使用.to_time(如上所述),使用.to_date,不使用任何东西,使用DateTime代替time。有什么建议吗?

试试这个:

Outproject.where('start_at >= ? and start_at <= ?', DateTime.now.beginning_of_week.utc,(DateTime.now.beginning_of_week + 5.days).utc)

Outproject.where('start\u at>=?和start\u at)可能有助于您在heroku配置中添加时区。