小编Mic*_*son的帖子

Rails 3.2 Heroku PG错误 - '运算符不存在:整数==整数'

这适用于我的开发环境,但是当我尝试使用Postgres通过Heroku运行时,我收到此错误.

2012-04-07T21:35:14+00:00 app[web.1]: ActiveRecord::StatementInvalid 
  (PG::Error: ERROR:  operator does not exist: integer == integer 
2012-04-07T21:35:14+00:00 app[web.1]: LINE 1: ...."value") AS avg_id FROM "datapoints"  
  WHERE (habit_id == 1) 
2012-04-07T21:35:14+00:00 app[web.1]: HINT:  No operator matches the given name and argument type(s). 
You might need to add explicit type casts. 
2012-04-07T21:35:14+00:00 app[web.1]: : SELECT  AVG("datapoints"."value") AS avg_id FROM "datapoints 
  WHERE (habit_id == 1)):
Run Code Online (Sandbox Code Playgroud)

以下是我的控制器的代码行:

Datapoint.average(:value, :conditions => ['habit_id == ?', self.habit_id])
Run Code Online (Sandbox Code Playgroud)

我对rails很新,所以这很容易就是一个非常简单的错误 - 对我在这里做错了什么的想法?

postgresql heroku ruby-on-rails-3

2
推荐指数
1
解决办法
3471
查看次数

标签 统计

heroku ×1

postgresql ×1

ruby-on-rails-3 ×1