Postgresql 运算符不存在:jsonb=integer
我收到以下postgres错误: “运算符不存在:jsonb=integer” 我的应用程序托管在Heroku上,我使用的是Postgres9.4DB。下面是我的帐户控制器与ahoy_matey分析gem的外观 客户控制员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
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是一个解决方案还是一个问题。。。我感到困惑:(