Slow test suites are a major pain point in projects, often due to RSpec and FactoryBot. Although minitest and fixtures...
While the main goal always is to prevent long-running queries in the first place, automatic timeouts can serve as...
You can improve your LIKE / ILIKE search queries in PostgreSQL by adding a GIN index with an operate class ("opclass...
Recently I needed to benchmark an Active Record query for performance measurements. I wrote a small script that runs each...
You are given two CSS selectors that you do not control. How can you build a new selector that matches...
Reacting on a class getting added can be done with a mutation observer. Example: const items = document.querySelectorAll('.item') const expectedClass...
I was recently asked to optimize the response time of a notoriously slow JSON API endpoint that was backed by...
ActiveModel classes have a class method .human_attribute_name. This returns a human-readable form of the attribute: Person.human_attribute...
tl;dr Do not use the option optional on association declarations with a symbol, lambda or proc. Explanation Association declarations...
This card describes four variants, that add a more intuitive workflow when working with nested attributes in Rails + Unpoly:
We are using assignable_values for managing enum values in Rails. Nevertheless Rails is adding more support for enum attributes...
Postgres works differently See PostgreSQL: Difference between text and varchar columns for PostgreSQL-specific info MySQL has 4 different column...
Debugging performance issues in your Rails app can be a tough challenge. To get more detailed insights consider using the...
tl;dr Prefer request specs over end-to-end tests (Capybara) to joyfully test file downloads! Why? Testing file downloads
You can chain multiple Capybara matchers on the page or any element: expect(page) .to have_content('Example Course')
These are the top ten accessibility errors as researched by TPGi, a company focusing on accessibility. See the linked article...
Today I stumbled across a pretty harmless-looking query in our application which turned out to be pretty harmful and...
All browsers implement an event named beforeunload. It is fired when the active window is closed and can be used...
A Rails script lives in lib/scripts and is run with bin/rails runner lib/scripts/.... They are a simple tool to perform...
There are a few tools to combat the dreaded n+1 queries. The bullet gem notifies you of missing eager...
Tested on Ubunut 22.04 1. Opener script Create a file ~/.local/bin/coverage_zip_opener with: #!/bin/bash tmp_folder="/tmp/coverage-report-opener" if [ -z "$1" ]
The linked article suggests an interesting way to speed up tests of Rails + Postgres apps: PostgreSQL allows the creation of...
A general overview about why and how we migrate can be found under Migrating from Elasticsearch to Opensearch
#pluck is commonly used as a performant way to retain single database values from an ActiveRecord::Relation Book.pluck(:title, :price...