0

I'm using the Ahoy Gem (https://github.com/ankane/ahoy) to track visits and events. When I try to use their where_event method to query the event model as described in the docs I get this error:

[191] pry(main)> Ahoy::Event.where_event("Reach", business_id: 4072).count
NameError: uninitialized constant Ahoy::QueryMethods
from /Users/rfrisch/projects/impact/app/models/ahoy/event.rb:2:in `<class:Event>'

event.rb

class Ahoy::Event < ActiveRecord::Base
  include Ahoy::QueryMethods

  self.table_name = "ahoy_events"

  belongs_to :visit
  belongs_to :user
end

As Ahoy::QueryMethods is provided by the gem I'm not sure how to go about addressing this error.

If I comment out the include line on event.rb then I can properly record events in the table but then I lose the ability to use the where_event method.

Any help getting this to work would be appreciated.

1 Answers1

0

Turns out I need to actually restart the console vs. just running reload!. Now all works as expected.