The Ruby and Rails community linklog
Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!
Submit a post
Post Preview
Note: Only the first pargraph is shown on the front page and overly long paragraphs may be broken up.
Ruby, map with index
There’s always a tiny doubt about how to “map with index” when using Ruby. Let’s see how, and we’re also going back to basics of Ruby map in this article. [more inside]
Weird Ruby: Heredoc Delimiters
The next installment in my Weird Ruby blog series.
How to reduce your method calls by 99.9% by replacing Thread#pass with Queue#pop
When doing multi-threaded work in Ruby, there are a couple of ways to control the execution flow within a given thread. In this article, I will be looking at Thread#pass and Queue#pop and how understanding each of them can help you drastically optimize your applications: [more inside]
Configuring Rails for headless tests
I wrote a post on configuring Rails system tests for headless and headfull browsers.
How to start a Ruby on Rails 7 app with Hotwire and Tailwind CSS
There are a lot of new features in Rails that might confuse you if you’re new to the framework. In this video I create a new Rails 7 project, and I explain what the different options mean when creating new projects. [more inside]
Rails 7 application inside Docker on macOS
Sometimes we want to play with the new version of Ruby/Rails, but in order to do so we need to install dependencies which quite often is not so seamless. So let’s take a look how to use Docker and shell commands in order to quickly start new project with any combination of Ruby/Rails version and keep the macOS itself clean as a baby’s bottom.
Adding database level check constraints to Rails validations
Strengthen your data integrity with check constraints:
💎 Ruby SMTP mock - mimic any 📤 SMTP server behaviour for your test environment
Flexible Ruby wrapper over smtpmock. Mimic any 📤 SMTP server behaviour for your test environment and even more:
Rubber Duck Dev Show Episode 25 | JavaScript Options in Rails 7
Hear two rubyists discuss the different JavaScript options available in the newly released Rails 7:
Build a minimal feature flag manager in under an hour
For those who need an on-and-off system, here’s a minimal feature flag manager that’ll take you less than an hour to build. It’s a plain Ruby object but its configuration leans on Ruby on Rails.
Ruby-on-Rails with ViteJS : a wonderful combination
The new Rails 7 frontend assets management seems better than the previous ones, but there is some room to completely replace it : there’s a gem that allows the developer to build the frontend entirely with ViteJS. And it rocks.
New Punk (Pixel Programming) Frequently Asked Questions (F.A.Q.) & Answers
Hello, I started a new “centralized” all-in-one page to collect all Punk (Pixel Programming - Yes, In Ruby -) Frequently Asked Questions (F.A.Q.) and Answers. It’s still the early days. The first entries include: Q: How can I generate 10 000 left-looking p(h)unks in any size (2x, 4x, 8x, etc.) individually, that is, one-by-one? Q: Is there a way to specify the tile width and height for ImageComposite (rather that the default 24 pixels)? Q: Am I allowed to create and sell my own [Crypto] Punks? Q: Can anyone explain the “Flex-How-Stupid-AND-Rich-I-Am?!” [Crypto] Punks? Why pay hundred thousands of dollars for a free public domain 24×24 pixel image? Questions and comments welcome.
Glimmer Metronome - Tap-based Tempo & Up/Down Beat Toggling
A while ago, I reported building a Glimmer Metronome sample using Glimmer DSL for SWT in only 10 minutes for the first version. Well, I extracted that sample into an external project to package as a native executable (Mac DMG file), and added tap-based tempo calculation, up/down beat toggling per-beat, mute button, stop/start button, and other improvements. [more inside]
Rails system tests with page objects
For a long time I am thinking of a better system tests organization. Let me know what you think!
Ruby strftime, short examples, long explanation
“strftime” stands for “string from time”. Which means “please Ruby format the time into a human-friendly format”. Let’s see how. [more inside]
Rails 7, Bootstrap 5 and importmaps without nodejs
Rails 7 provides a —css=bootstrap option to setup a new project, but this actually relies on node, esbuild and jsbundling. Can we actually have Bootstrap working without depend on nodejs? Yes. We can! [more inside]
Using Opal Ruby with Rails 7
Opal enables writing web front-end code in Ruby, thus producing highly maintainable, productive, and understandable code on both the client-side and server-side. [more inside]
Deployment from Scratch birthday giveaway!
It’s my birthday today so I am doing a giveaway of my book Deployment from Scratch. Just retweet the post on Twitter to participate (no need to follow me!)
Single attribute in-place editing with Rails and Turbo
Have you wondered what’s the simplest way to enable in-place (inline) editing of your models’ attributes? I just published a post on in-place attribute editing with Rails and Turbo.