Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.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
Postgresql 运算符不存在:jsonb=integer_Postgresql_Ruby On Rails 4_Heroku_Jsonb_Ahoy - Fatal编程技术网

Postgresql 运算符不存在:jsonb=integer

Postgresql 运算符不存在:jsonb=integer,postgresql,ruby-on-rails-4,heroku,jsonb,ahoy,Postgresql,Ruby On Rails 4,Heroku,Jsonb,Ahoy,我收到以下postgres错误: “运算符不存在:jsonb=integer” 我的应用程序托管在Heroku上,我使用的是Postgres9.4DB。下面是我的帐户控制器与ahoy_matey分析gem的外观 客户控制员 class AccountsController < ApplicationController before_filter :authenticate_user! def index if current_user.business_id

我收到以下postgres错误:

“运算符不存在:jsonb=integer”

我的应用程序托管在Heroku上,我使用的是Postgres9.4DB。下面是我的帐户控制器与ahoy_matey分析gem的外观

客户控制员

class AccountsController < ApplicationController
  before_filter :authenticate_user!

  def index
    if current_user.business_id
      @business = Business.find(current_user.business_id)
      # analytics
      @monthly_business_views = ahoy_event_sum("Page Viewed", @business.id)
      @monthly_get_websites = ahoy_event_sum("Visited Website", @business.id)
      @monthly_get_directions = ahoy_event_sum("Directions Viewed", @business.id)
      @monthly_get_fb_shares = ahoy_event_sum("Shared via Facebook", @business.id)
      @monthly_get_tweets = ahoy_event_sum("Tweeted via Twitter", @business.id)
      @reviews = Review.where(:business_id => @business).all
    end
  end

  ...

  def ahoy_event_sum(event, business_id)
    Ahoy::Event.where(name:event, properties: business_id).count
  end

end
class AccountsController@business)。全部
结束
结束
...
def ahoy_事件总数(事件、业务id)
Ahoy::Event.where(名称:Event,属性:business\u id).count
结束
结束
Ahoy事件模型

module Ahoy
  class Event < ActiveRecord::Base
    self.table_name = "ahoy_events"

    belongs_to :visit
    belongs_to :user

    serialize :properties, JSON
  end
end
模块Ahoy
类事件

我有中级技能,很抱歉,如果这个问题有一个简单的解决方法,请提供我将如何解决这个问题的任何细节。谢谢

我假设,“ahoy_事件”。“属性”列是
jsonb
,您试图将其与
integer
1
进行比较。顺便说一句,您使用的是
json
还是
jsonb
@Dmitry我使用的是
jsonb
所以
ahoy
数据模型应该包含
jsonb
@Dmitry是一个解决方案还是一个问题。。。我感到困惑:(