A collection of my articles on web development, Ruby on Rails, and more.
While building a script to test ruby version upgrades in a
rbenv-enabled system, I noticed that running
bundle install from within a ruby script uses the script’s version of ruby instead of the one defined in the directory.
I’m working on an app using
ActiveRecord storage. To debug a gnarly issue, I had to copy the production database to development, but didn’t want to download the blobs themselves. Here’s how to serve a fallback image when an
ActiveStorage file is missing from the
The Bridgetown documentation is well-written but doesn’t explain everything needed to add FontAwesome, so I documented the steps while converting my website.
I wanted to implement a generic filtering concern for Rails models, and decided to do things a bit differently from what Justin Weiss and Fabio Pitino did.
You can store native JSON data in Postgres databases, and Rails now allows taking advantage of that format.
While building a Rails 6 application, I needed to generate pretty URLs using a model name. I also wanted these URLs to change when the model name was changed, and redirect to the latest URL if someone visited the old URL. As an added constraint, I’m using the CanCanCan authorization gem to handle rights management. Here is the setup I came up with to redirect old URLs while preserving most of the gem’s expected behaviour.