运算符不存在:jsonb =整数

时间:2015-12-12 00:16:30

标签: postgresql ruby-on-rails-4 heroku jsonb ahoy

我收到以下postgres错误:

"运算符不存在:jsonb = integer"

operator does not exist: jsonb = integer

我的应用程序托管在Heroku上,并使用Postgres 9.4 DB。以下是我的帐户控制器与ahoy_matey analytics 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

Ahoy活动模型

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

    belongs_to :visit
    belongs_to :user

    serialize :properties, JSON
  end
end

如果这个问题有一个简单的解决方法,我有中级技能并道歉,请提供有关如何解决此问题的任何详细信息。谢谢!

0 个答案:

没有答案