Unpoly's [up-observe], [up-autosubmit] and [up-validate] as well as their programmatic variants up.observe() and up.autosubmit...
tl;dr Since Rails 7+ you can use ComparisonValidator for validations like greater_than, less_than, etc. on dates, numerics...
Case studies and experiments demonstrating the impact of web performance optimization (WPO) on user experience and business metrics.
To allow HTTP 304 responses, Rails offers the fresh_when method for controllers. The most common way is to pass...
For Rails models where only one of multiple attributes may be filled out at the same time, there is no...
Greg Molnar has written a neat article about creating a single-file Rails app. This is not meant for production...
When working with feature branches, stale branches pile up over time. It's best to remove them right after merge...
Recently we detected a memory leak in one of our applications. Hunting it down, we found that the memory leak...
The linked content includes a few design patterns implemented with Ruby on Rails. What is the card indented to achieve...
SELECT pg_size_pretty(pg_database_size('some-database')); Example SELECT pg_size_pretty(pg_database_size('cards_p')); ----------------
When paginating records, we usually need to know the number of total records in order to render pagination links. Popular...
I recently wanted to add a model for address information but also wanted to add a unique index to those...
Imagine these models and associations: class Deck < ApplicationRecord has_many :cards end class Card < ApplicationRecord belongs_to :deck, optional: true...
It might sometimes be useful to check whether your Rails application accesses the file system unnecessarily, for example if your...
Testing file download links in an end-to-end test can be painful, especially with Selenium. The attached download_helpers.rb provides...
There is a way to use multiple databases in Rails. You may have asked yourself how you're able to...
tl;dr You can use attribute? as shorthanded version of attribute.present?, except for numeric attributes and associations. Technical Details
You can use Unpoly's up.on with a named listener function and immediately unbind this event listener with { once: true...
tl;dr: Use the URLSearchParams API to make your live easier if you want to get or manipulate query parameters...
Redis.current will be removed without replacement in redis-rb 5.0. Version 4.6.0 adds deprecation warnings for Redis.current and Redis.current=: `Redis.current...
RSpec's let allows you to super into "outside" definitions, in parent contexts. Example: describe '#save' do subject { described_class.new(attributes...
Sometimes we write plain SQL queries in migrations so we don't have to mock ActiveRecord classes. These two migrations...
Since Rails 6.1, if we use where.not with multiple attributes, it applies logical NAND (NOT(A) OR NOT(B)) instead...
In my case [...] the catalog is an XML that contains all kinds of possible products, categories and vendors and it...