Brian Carpenter


2,350 Experience
8 Lessons Completed
2 Questions Solved


Hey, sorry for the delay on this. I got sidetracked. Just pulled up the code and confirmed I have the Ahoy js event tracking working. I'm using the jumpstart pro template, Rails 7.0.4, ruby 3.1.2p20.

Here's some relevant code in case you have not found a working solution.

Calling Ahoy.js from inside stimulus controller.

import { Controller } from "@hotwired/stimulus"
import { Turbo } from "@hotwired/turbo-rails"
import ahoy from "ahoy.js";

ahoy.track("event_name", { foo_event_name: 'foo'})

gem file

gem "ahoy_matey"


class Ahoy::Store < Ahoy::DatabaseStore

# set to true for JavaScript tracking
Ahoy.api = true

Ahoy.geocode = false

Happy to share whatever else might be helpful and I'll try to be more responsive. Also, if you have not checked out the GoRails discord you should. I've been able to get lots of good support for this type of stuff there.

Posted in Tracking Metrics with Ahoy and Blazer Discussion

Yeah, I did. I’m traveling but can dig up the code (hopefully) in the next 24 hours or so. I’ll post here and let you know. If I remember correctly my issue was not using the correct path for the import.

Posted in How to use Uppy with ActiveStorage Discussion

I built a stimulus controller for this but ran into some issues getting the uppy stylesheets to load. I spent a lot of time trying to figure it out. Putting details here so I don't lose them or perhaps they can be helpful for somebody else. This solution is using an, as of now, unmerged request to excid3/uppy-activestorage-upload so you may/may not want to use it as a dependency.

Found this video which figures out a working solution using an unmerged pull request from excid3/uppy-activestorage-upload by puglet5/uppy-activestorage-upload.

For me relevant parts are at 1:20:26

let uppy = new Uppy({
autoProceed: false,
allowMultipleUploads: true,
debug: true,
logger: Uppy.debugLogger


package.json changed:

"dependencies": {
"@excid3/uppy-activestorage-upload": "",

"@excid3/uppy-activestorage-upload": ""

yarn install

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.


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

© 2024 GoRails, LLC. All rights reserved.