Skip to main content

Posts (Page 2)

Where to host your Ruby on Rails App in 2020

So many options?! But which is the best all round for hosting & ease of deployment?

How to get the time an ActiveJob was enqueued at

Knowing the exact time you queued up a background job is handy, here is how to get it in Ruby on Rails ActiveJob.

How to use Rails.ajax in Stimulus Controllers

Make AJAX calls using Rails.ajax by including UJS into your Stimulus controller files.

Decoupling copy from your Ruby on Rails code with I18n

I18n is a great way to quickly translate your app, but it's also a great way to tidy up your code.

How to name Active Job Classes and Queues

Strategies for name spacing Active Job queues & class names.

How to Lint FactoryBot Factories with RSpec

Invalid factories are the worst. Here is a script I normally drop into my rails projects to help spot them.

How to set "Cache-Control" headers for Rails Webpacker & Sprockets Assets

Fix that pesky "Serving static assets with an efficient cache policy" PageSpeed suggestion.

How to Speed Up Heroku CI via In Dyno Databases

My tests were feeling very slow in Heroku CI, I got a 2x speedup by changing one line of code.

How to use Yard for offline documentation

I like to work offline, this documents my current setup & how I'm using puma-dev to make it effortless.

Listening to Bootstrap Events in Stimulus Controllers

Bootstrap fires events via jQuery, which doesn't play to nicely with Stimulus. Here is how to make them play nicely.