Using rack-mini-profiler (with Unpoly)

Posted 10 days ago by Niklas Hä..

Debugging performance issues in your Rails app can be a tough challenge. To get more detailed insights consider using the...

Caution: rem in @media query definitions ignore your font-size

Posted 11 days ago by Dominik Schöler.

Note Using rem only ever makes sense when the root font size is dynamic, i.e. you leave control to the...

Debug SAML in development using a local keycloak server

Posted 17 days ago by Martin Schaflitzl.

Developing or debugging SAML functionality can be a hassle, especially when you need to go back and forth with someone...

Geordi 10.0.0 released

Posted About 2 months ago by Dennis.

10.0.0 2024-03-07 Compatible changes console command: You can now globally disable the IRB multiline feature by setting irb...

Chaining Capybara matchers in RSpec

Posted About 2 months ago by Henning Koch.

You can chain multiple Capybara matchers on the page or any element: expect(page) .to have_content('Example Course')

Accessibility: Making non-standard elements interactive

Posted About 2 months ago by Michael Leimstädtner.
developer.mozilla.org

A common cause of non-accessible web pages are elements that were made interactive via JavaScript but cannot be focused...

Top Accessibility Errors in 2023

Posted About 2 months ago by Dominik Schöler.
tpgi.com

These are the top ten accessibility errors as researched by TPGi, a company focusing on accessibility. See the linked article...

Be careful when checking scopes for blankness

Posted 2 months ago by Dominic Beger.

Today I stumbled across a pretty harmless-looking query in our application which turned out to be pretty harmful and...

How to display an unsaved changes alert

Posted 3 months ago by Michael Leimstädtner.

All browsers implement an event named beforeunload. It is fired when the active window is closed and can be used...

Heads up: You should always use "current_window.resize_to" to resize the browser window in tests

Posted 3 months ago by Michael Leimstädtner.

I recently noticed a new kind of flaky tests on the slow free tier GitHub Action runners: Integration tests were...

Where to keep project files that should not go to Git

Posted 3 months ago by Dominik Schöler.

Sometimes you have a file that is related to a project, while not actually being part of it. You'd...

Best practices: Writing a Rails script (and how to test it)

Posted 3 months ago by Dominik Schöler.

A Rails script lives in lib/scripts and is run with bin/rails runner lib/scripts/.... They are a simple tool to perform...

Rails: Testing the number of database queries

Posted 3 months ago by Dominik Schöler.
github.com

There are a few tools to combat the dreaded n+1 queries. The bullet gem notifies you of missing eager...

Unpoly 3.7.1, 3.7.2 and 3.7.3 released

Posted 4 months ago by Henning Koch.
unpoly.com

Version 3.7.0 broke some things in complex forms. Sorry for that. Concurrent user input is hard. 3.7.1 This change fixes...

Disable PostgreSQL's Write-Ahead Log to speed up tests

Posted 4 months ago by Michael Leimstädtner.
edgeapi.rubyonrails.org

The linked article suggests an interesting way to speed up tests of Rails + Postgres apps: PostgreSQL allows the creation of...

Capistrano: creating a database dump if migrating

Posted 5 months ago by Dominik Schöler.

In Capistrano 3, your Capfile requires 'capistrano/rails/migrations', which brings two Capistrano tasks: deploy:migrate and deploy:migrating. The former checks...

Rails: Pluck across associated tables

Posted 5 months ago by Dennis.

#pluck is commonly used as a performant way to retain single database values from an ActiveRecord::Relation Book.pluck(:title, :price...

Transfer records to restore database entries (with Marshal)

Posted 5 months ago by Daniel Straßner.

If you ever need to restore exact records from one database to another, Marshal might come in handy. Marshal.dump is...

Ruby: Using `sprintf` to replace a string at fixed named references

Posted 5 months ago by Felix Eschey.
docs.ruby-lang.org

The sprintf method has a reference by name format option: sprintf("% d : % f", { :foo => 1, :bar => 2 }) # => 1 : 2.000000

How to: Upgrade CarrierWave to 3.x

Posted 6 months ago by Dominic Beger.

While upgrading CarrierWave from version 0.11.x to 3.x, we encountered some very nasty fails. Below are the basic...

PSA: Be super careful with complex `eager_load` or `includes` queries

Posted 6 months ago by Tobias Kraze.

TLDR Using .includes or .eager_load with 1-n associations is dangerous. Always use .preload instead. Consider the following ActiveRecord...

Heads up: Quering array columns only matches equally sorted arrays

Posted 6 months ago by Michael Leimstädtner.

Given you have an array column like this: create_table "users", force: :cascade do |t| t.integer "movie_ids", default: [], array...

Spreewald, Cucumber: Selector for the nth element

Posted 6 months ago by Felix Eschey.

The recommended additional setup of the spreewald gem, a useful set of cucumber steps, includes adding a file for defining...

How to make sure that manual deploy tasks (scheduled in Pivotal Tracker) are executed on deploy (with Capistrano)

Posted 7 months ago by Dominik Schöler.

We regularly have tasks that need to be performed around a deploy. Be it to notify operations about changed application...