3

I am getting the following postgres error:

"operator does not exist: jsonb = integer"

operator does not exist: jsonb = integer

I have my application hosted on Heroku and am using a Postgres 9.4 DB. Below is what my accounts controller looks like with the ahoy_matey analytics gem.

Accounts Controller

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 Events Model

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

    belongs_to :visit
    belongs_to :user

    serialize :properties, JSON
  end
end

I have intermediate skills and apologize if this question has a simple fix, please provide any details on how I would solve this issue. Thanks!

Dmitry S
  • 4,990
  • 2
  • 24
  • 32
Justin Seidl
  • 249
  • 1
  • 2
  • 13

0 Answers0