Check version number of docs and tutorials always

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the workflows category.

Last Updated: 2024-04-25

I wanted to know how to assert a h1 tag has some text in Rails. I Googled and found this code:

assert_select 'h1', 'abc'

This failed and caused me much confusion in debugging. In fact this line controlled HTML select boxes! This selector for testing had since been renamed to assert_selector.

Why the issue? I was on the docs for rails v4.1 during the time of Rails v6.

Generally speaking, I should ensure the docs match my version number before moving a second further. Better yet, I should become fluent with CLI doc tools that are generated from the code itself. This would eliminate the problem for the most part.

Story 2

I tried for ages to get the text to change color in Semicolon&Sons with tailwindcss. According to the video I watched online, I could simply do .text-purple I tried this and it failed. Then I went down a long and fruitless search for theme files, WebPack bugs, etc.

Ultimately I figured out the issue: the video was out of date and it referred to a previous version of tailwindcss. When I referred to the tailwind site and looked up my version (1.2) it said I should use a different class .text-purple-500

The lesson here is to stick to tutorials that cover current versions.