Next.js to Ruby

I have been working on converting something from Next.js to Ruby. The Next.js version is still more visually appealing to me, but the benefits of working in Ruby far supior to me long term.


    <Card as="article">
      <Card.Title href={`/articles/${article.slug}`}>
      <Card.Eyebrow as="time" dateTime={} decorate>
      <Card.Cta>Read article</Card.Cta>


    {%@ Shared::Card::Card as: :article do %}
      {%@ Shared::Card::Title as: :h2, href: article.relative_url do %}
      {% end %}
      {%@ Shared::Card::Eyebrow as: :time, dateTime:, decorate: true do %}
      {% end %}
      {%@ Shared::Card::Description do %}
      {% end %}
      {%@ Shared::Card::Cta do %}Read article{% end %}
    {% end %}

TailwindCSS IntelliSense with Serbea

I have been experimenting with Serbea templates with Bridgetown and was not able to get TailwindCSS IntelliSense to work.

Serbea files using the file extension .serb, so my first attempt to configure it looked like this:

"tailwindCSS.includeLanguages": {
  "serb": "html"

However, what I needed to do was specify the file content type:

"tailwindCSS.includeLanguages": {
  "serbea": "html"

Lots of great little PostgreSQL date tricks by @robconery

Using PostgreSQL to Handle Calendar Data Like a Freak - YouTube

Finding and Fixing Files in Git with Mixed Case

I cloned a repo with a couple of files that were duplicated because of case sensitivity. Git was nice enough to warn me about them, but I couldn’t remember which files where an issue.

Two of them became a problem and were fixed, but I was sure there were more than two when I cloned the repro.

I found this excellent script to highlight and fix the problem files: git-detect-case-change

I didn’t realize Bullet Train was now open source (it looks like you have to pay to use Stripe, but that feels very fair).

I have not dug too deeply into yet, so no opinion other than it is probably worth looking through it before you start your next project.

Migrating from a Postgres Cluster to Distributed SQLite with LiteFS

I love me some Postgres, but the SQLite with LiteFS (via @flydotio) just sounds fun.

Steps to use solargraph for Rails projects in VS Code (WIP)

This is quite handy. I am unsure how it would handle multiple versions of Ruby, so I skipped updating the shim location and instead just installed the gems in my main 2 Ruby versions.

A nice quality-of-life improvement in Ruby 3.2 Enumerator::product

How to validate the presence of a boolean field in a Rails model

There is a subtle bug that happens when validating the presence of boolean fields in Rails. Ensuring adequate test coverage helps us find those issues before they hit production.

The quick and simple editor for cron schedule expressions

I do not write crontabs often, but when I do, it is usually with

Active Record enum form select

I find myself using this on almost all of my rails projects. I am surprised something like this isn’t available out of the box yet.

Finally made the autocomplete for IRB in Ruby 3.0 readable with my Dracula color scheme. All it took was changing the terminal’s definition of Cyan. Hopefully, this will be configurable in the future.

Rails and Docker


Setting up Rails for the first time with all the dependencies necessary can be daunting for beginners. Docked Rails uses a Rails CLI Docker image to make it much easier, requiring only Docker to be installed.

I have never been efficient with Docker in the past, but the brevity of this Docker file and knowing the hoops I had to jump through over the years with homebrew, rbenv, and more over the years is making me think it might be time to revisit a docker setup and work env.

David Kimura posted a comment with a more elaborate setup, but this still feels much simpler than what I am doing today.


There are many templates to jump-start a project and few options to add something to an existing project.

Ruby on Rails templates allow you to add features to both old and new apps. Check out our repository of templates for adding everything from authentication to error monitoring to your apps.

See: RailsBytes

A Rubyist’s Introduction to Character Encoding, Unicode and UTF-8

…learn how character encodings work and how they’re implemented in Ruby. By the end, you’ll be able to understand and fix these errors….

Starting the explanation with Morse Code was a nice touch.

Adding Paging Titles for Short Posts

I noticed posts without titles do not have proper HTML Title tags on my new

Even as I type this, I kind of get it. How do you have a title without a title? 🤔

Many services rely on a title element when building links, and seeing “ScottW’s Blog” (or whatever I eventually name this thing) looks silly.

I checked the source for a couple other templates and found none of them did anything special to handle the missing title. Most looked something like this:

<title>{{ if not .IsHome }}{{ .Title }} - {{ end }}{{ site.Title }}</title>

After some trial and error, I noticed the .Summary value for the default meta description tag and decided to use that. This is the first ‘code’ I have written in Hugo, so it might need some more tweaking in the future:

      {{ if .IsHome }}
      {{ else if .Title }}
        {{ .Title }}
      {{ else}}
        {{ .Summary }}}
      {{ end }}
      - {{ .Site.Title }}

CSS Loaders 100 sample loaders are all done with CSS. I continue to be amazed at what can be done with CSS, even with a personal goal to write as little CSS as possible for the rest of my life. 😄

Rails Safety Mechanisms

An overview of some of the ways Rails protects you from yourself.

Percent notation in Ruby

You can put this in the “the more you know” category.


Phlex is a framework for building fast, reusable, testable views in pure Ruby.

I look forward to trying Phlex for a small project in the next couple of weeks.

I am still a fan of ViewComponent as well, but the markdown support for Phlex might be a game changer for me.

ShortRuby - The best part about checking email on Monday morning is finding a new ShortRuby newsletter.

This is a weekly newsletter about what happens in Ruby’s world (mainly on Twitter) curated by @lucianghinda

Ruby Bitwise Operators

The CodingFont game is excellent, but what if you want to do a quick test drive?

Well, here you go Programming Fonts.

Programming Fonts Screenshot

CodingFont is a fun bracket game that helps you pick a coding font.

I recommend checking the Hide Font Names option.

My winner was Azeret Mono. A younger me would have picked a smaller font, but I will give this one a shot for a couple weeks.

Optimizing ActiveRecord SQL Memory Usage in Rails

A decent suggestion by Patel Urbanek - Easy to Miss Way to Optimize ActiveRecord SQL Memory Usage in Rails.

Urbanek recommends using select in your ActiveRecord queries to limit the fields returned and thus save memory. While this certainly will work, I find it messy long term.

  1. It is not obvious what data you have access to. Your code appears to have access to the user object, but most of the data is missing.
  2. Similar to #1, other helpers/decorators/etc. that you have in your codebase may have model requirements that are not obvious as well. You pass along this partial object, and you may have some unintended consequences.
  3. If you use any kind of caching, you may accidentally expose this partial object to completely unaware parts of your app

I typically use two approaches:

  1. pluck - As suggested in the article, you may be giving up some of your model niceties. Still, it is usually a worthwhile trade-off if the amount of data returned warrants optimization. It can also help expose some code that should not live directly within your model.
  2. pluck and Struct - when using pluck gets too messy, you can always take the data returned and load it into a struct (or a PORO).