Brian Carpenter


2,320 Experience
8 Lessons Completed
2 Questions Solved


Posted in Tracking Metrics with Ahoy and Blazer Discussion

Anyone using Ahoy on rails 7? Server side is working fine but getting errors on client side that "ahoy is not defined"

gem file

gem "ahoy_matey"


class Ahoy::Event < ApplicationRecord
  include Ahoy::QueryMethods

  self.table_name = "ahoy_events"

  belongs_to :visit
  belongs_to :user, optional: true


class Ahoy::Visit < ApplicationRecord
  self.table_name = "ahoy_visits"

  has_many :events, class_name: "Ahoy::Event"
  belongs_to :user, optional: true

console output

player.js:23 Uncaught ReferenceError: ahoy is not defined
    at togglePlay (player.js:23:7)
    at HTMLAnchorElement.<anonymous> (player.js:14:9)


ahoy.track("Played Audio", audio_detail)


class Ahoy::Store < Ahoy::DatabaseStore

  Ahoy.api = true

  Ahoy.geocode = false

Typing ahoy.track("test") directly in console also return the same error.

Any help/thoughts?

Found this link on how to reference a blob for use with another model.

I'd like to access a file object that already exists in active storage and re-attach it to another model. Something like

Is this possible?

Variations of rails_blob_path and url_for methods produce invalid signature errors.

Posted in Go Rails' Stripe lesson and strong params


Very helpful, thanks.

I have a situation where I'm generating N post requests for given table in a vuejs app, but sending them to the rails controller one by one. I'd like to batch them all up in the app as a JSON object, then send one request over and let rails parse it out.

Would this be as simple as writing a custom controller action?

Wondering if rails has a framework/method for handling batch requests or if there's some standard approaches I should be using.


logo Created with Sketch.

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

© 2022 GoRails, LLC. All rights reserved.