Greg Molnar has written a neat article about creating a single-file Rails app. This is not meant for production...
When your Rails application offers downloading a bunch of files as ZIP archive, you basically have two options:
The linked content includes a few design patterns implemented with Ruby on Rails. What is the card indented to achieve...
This should be fixed in the latest LTS-branches of our mysql2 fork, 0.2.x-lts and 0.3.x-lts...
SELECT pg_size_pretty(pg_database_size('some-database')); Example SELECT pg_size_pretty(pg_database_size('cards_p')); ----------------
Ruby includes many standard gems that are bundled into the Ruby installation. Here is an example for the gem strscan...
When paginating records, we usually need to know the number of total records in order to render pagination links. Popular...
You can use the code below to check whether the browser can make connections to the current site: await isOnline...
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...
tl;dr With ES2021 you now can use str.replaceAll(), Promise.any(), logical assignment operators, numeric separators and WeakRef on all major...
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...
This card explains how to generate an entity relationship diagram for your Rails application. We also show how to limit...
RSpec's let allows you to super into "outside" definitions, in parent contexts. Example: describe '#save' do subject { described_class.new(attributes...
In SQL, NULL represents an "unknown" value. Because of this, it does not behave like a standard piece of data...
When using where.not with a Hash of multiple attributes, Rails applies logical NAND (NOT (A AND B)). This contrasts with...
An element with display: grid can define its grid-template-columns based on (preferred) child width using the repeat function...
Use option:checked to find the currently selected option: select.querySelector('option:checked') Yes, :checked, not :selected. This is the same...
In my case [...] the catalog is an XML that contains all kinds of possible products, categories and vendors and it...
TL;DR When using Cache-Control on a Rails application, make sure the Vary: Accept header is set.