Event sourcing is a jargon filled mess, but we can build a lean version with just ActiveRecord, callbacks, and a bit of boring code. Learn how to create simple, yet powerful event-driven systems in Rails.| Boring Rails: Skip the bullshit and ship fast |
Mailers are used in literally every Rails application, but often an after thought where we throw out the rules of software design. Revisiting the tools provided by Action Mailer can help us improve how we write mailers.| Boring Rails: Skip the bullshit and ship fast |
Rails enums are a great way to model things like a status on an ActiveRecord model. They provide a set of human-readable methods while storing the result as an integer in the database.| Boring Rails: Skip the bullshit and ship fast |
Your mental model for Hotwire should be progressive enhancement: start with the basics and layer on Turbo Frames, Streams, and Stimulus as you build more.| Boring Rails: Skip the bullshit and ship fast |
Techniques for working with CSS in Hotwire and Rails that will make you say "wait..you did that with only CSS?!"| Boring Rails: Skip the bullshit and ship fast |
A review of the ecosystem for adding hotkeys to your Stimulus controllers: stimulus-hotkeys, stimulus-use/useHotkeys, HotKey.js, and github/hotkey| Boring Rails: Skip the bullshit and ship fast |
One of the oldest helpers in Rails is also the most underrated. `dom_id` shines for building apps with Hotwire, allowing you to easily target parts of the page without a bunch of nasty string interpolation.| Boring Rails: Skip the bullshit and ship fast |
Add sprinkles of Javascript behavior with Stimulus controllers that run a few lines of code and then remove themselves from the page. Like inlined jQuery snippets but for the modern times!| Boring Rails: Skip the bullshit and ship fast |
Build polished UI components with StimulusJS and Enter/leave CSS Transitions using patterns from Vue, Alpine, and Tailwind.| Boring Rails: Skip the bullshit and ship fast |
When building features that accept user-generated content, you may need to display dynamic content based on what the user specifies. Imagine you want to users to be able to customize a welcome message sent from your application when they invite someone to their account.| Boring Rails: Skip the bullshit and ship fast |
Environment variables are a great way to configure your Rails apps. You can use the Rails.env variable to conditionally change behavior when you are in development/test or production. And you can add your own application specific variables for things like API tokens or global settings.| Boring Rails: Skip the bullshit and ship fast |
One of the most common Rails tips is to back up your ActiveRecord model validations with database level constraints.| Boring Rails: Skip the bullshit and ship fast |
It’s always best to follow a systematic approach when trying to speed up slow code.| Boring Rails: Skip the bullshit and ship fast |
A common question you may want to answer on user-input data is: what values have been entered and how many times is each one used?| Boring Rails: Skip the bullshit and ship fast |
In almost all email programs, you can add a display name before your email address like so:| Boring Rails: Skip the bullshit and ship fast |
Custom Rails helpers modules are often overlooked, but they can be a great option for building lightweight components and reducing boilerplate in your Stimulus controllers.| Boring Rails: Skip the bullshit and ship fast |
Often you’ll have an application screen like this:| Boring Rails: Skip the bullshit and ship fast |
Hotwire is a new suite of frontend tools from Basecamp for building “reactive Rails” apps while writing a minimal amount of JavaScript.| Boring Rails: Skip the bullshit and ship fast |
GitHub Actions is an automation platform that you run directly from inside a repository. We can use it as a testing CI/CD pipeline and keep everything close to the code.| Boring Rails: Skip the bullshit and ship fast |
If you’re trying to write a tricky ActiveRecord query that includes joins, complex where clauses, or selecting specific values across tables, it can be hard to remember every part of the ActiveRecord DSL.| Boring Rails: Skip the bullshit and ship fast |
One of the best parts about ActiveRecord is the chainable query interface:| Boring Rails: Skip the bullshit and ship fast |
It’s a great idea to make your database and application validations match. If you have validates :name, presence: true in your model, you should pair it with a not null database constraint. Unique validations should be paired with a UNIQUE database index.| Boring Rails: Skip the bullshit and ship fast |
Breadcrumbs are a common UI pattern in most software applications. Rails has no built-in tools specifically for breadcrumbs, and while thereare ahandfulof existinggems, I think this is something you can easily implement in your own app with just a few lines of code.| Boring Rails: Skip the bullshit and ship fast |
If you follow a strict REST / nested resources approach to building your Rails app, you might get sick of repeating common controller actions.| Boring Rails: Skip the bullshit and ship fast |
Sometimes want to skip certain validations on your database models. Maybe you have a multi-step wizard or want admins to have more freedom in changing data.| Boring Rails: Skip the bullshit and ship fast |
You can’t prove a negative, but what about querying a database for a negative? While the majority of the time you are writing queries to find data, there are some cases when you want the opposite: writing a query that looks for the absence of data.| Boring Rails: Skip the bullshit and ship fast |
Sometimes a feature in your application will involve a back-and-forth between multiple users. When it comes time to write an automated system test, you can easily simulate switching between users using Capybara’s using_session helper.| Boring Rails: Skip the bullshit and ship fast |
Rails has a great, expressive term called pluck that allows you to grab a subset of data from a record. You can use this on ActiveRecord models to return one (or a few) columns.| Boring Rails: Skip the bullshit and ship fast |
When it comes to compare dates, for some reason my brain really struggles. I mix up < and >= all the time and end up flipping them.| Boring Rails: Skip the bullshit and ship fast |
One reason I love writing Ruby is that it’s optimized for programmer happiness. The Ruby community values code that is super readable.| Boring Rails: Skip the bullshit and ship fast |
Writing blog posts in Markdown is just great. This blog is written in Markdown!| Boring Rails: Skip the bullshit and ship fast |
Heroku Dataclips enable you to create SQL queries for your Heroku Postgres databases and share the results with colleagues, third-party tools, and the public. Recipients of a dataclip can view the data in their browser and also download it in JSON and CSV formats.| Boring Rails: Skip the bullshit and ship fast |
It’s common to use environment variables to configure external services or other options in a Rails app. These ENV_VARS usually are not checked into source control, but rather configured per environment.| Boring Rails: Skip the bullshit and ship fast |
Ever get frustrated trying to search through code on GitHub? Or wish you could put a breakpoint in a gem so you could figure out what it was doing?| Boring Rails: Skip the bullshit and ship fast |
A common practice in Rails apps is to extract logic into plain-old Ruby objects (POROs). But often you are passing data to these objects directly from controller params and the data comes in as strings.| Boring Rails: Skip the bullshit and ship fast |
The Rails helper excerpt can extract a chunk of text that matches a certain phrase, no matter where in the string it is.| Boring Rails: Skip the bullshit and ship fast |
We’re all familiar with the classic Rails link_to helper. But did you know there is a link_to_unless_current variant?| Boring Rails: Skip the bullshit and ship fast |
Sometimes you need to keep track of how many times you’ve looped when rendering some views, for instance to alternate background colors to create a “striped” table.| Boring Rails: Skip the bullshit and ship fast |
Use the Rails highlight helper to wrap search result matches in <mark> tags.| Boring Rails: Skip the bullshit and ship fast |
Responsive HTML data tables are a tricky problem that usually requires scrolling on small screens. With a sprinkle of Stimulus and the IntersectionObserver API, we can build a small enhancement to make the user experience more pleasant.| Boring Rails: Skip the bullshit and ship fast |
A recap of my Rails-related contributions for the 2020 Hacktoberfest event: ViewComponent, Bullet, LRUG, and Circulate| Boring Rails: Skip the bullshit and ship fast |
Feature flags bridge the gap between the abstract concept of continuous delivery and tactical release of features. Start small with a glorified if-statement before adding more complicated tooling to get the most bang for your buck.| Boring Rails: Skip the bullshit and ship fast |
A practical checklist for tidying up your gems, pruning old git branches, removing unused views and routes, and cleaning up your database. A little bit goes a long way when it comes to cleaning!| Boring Rails: Skip the bullshit and ship fast |
Sometimes we need to generate really large file exports or run reports that are just slow. It's not enough to optimize a few queries, we need to move the work to a background job and notify the user when it's all done.| Boring Rails: Skip the bullshit and ship fast |
Rails database migrations are extremely powerful, but can be a mess if we don’t avoid the traps. This article outlines a boring way to handle schema and data migrations effectively.| Boring Rails: Skip the bullshit and ship fast
Learn about the boring tools and practices used by Basecamp, GitHub, and Shopify to keep you as happy and productive as the day you typed rails new| Boring Rails: Skip the bullshit and ship fast
Using ViewComponents that know how to refresh themselves via turbo_streams is a powerful pattern to build complex flows with Hotwire| Boring Rails: Skip the bullshit and ship fast
Turbolinks, Stimulus, and Server Rendered HTML is a compelling alternative to modern JavaScript single page apps. Let’s build a hovercard to see how you can kick it old school with a more boring approach.| Boring Rails: Skip the bullshit and ship fast
Stimulus sprinkles interactive behavior on top of your boring HTML pages. By keeping your controllers small, generic, and composable you can build a front-end without the typical JavaScript mess.| Boring Rails: Skip the bullshit and ship fast