Checklist for Implementing Design

Posted 9 months ago by Dominik Schöler.

We have a long-standing checklist for merge requests. However, it hardly matches the intricate requirements for design. This checklist...

Best practice: How to manage versions in a Gemfile

Posted 9 months ago by Emanuel.

It most cases it's not necessary to add a version constraint next to your gems in the Gemfile. Since...

Don't assert exceptions in feature specs

Posted 10 months ago by Michael Leimstädtner.

As we are slowly switching from Cucumber scenarios to RSpec feature specs, you might be tempted to write assertions like...

The numericality validator does not care about your BigDecimal precision

Posted 11 months ago by Michael Leimstädtner.

Looking at the source code of the validates_numericality_of validator, it becomes clear that it converts the attribute in...

Preventing users from uploading malicious content

Posted 11 months ago by Henning Koch.

When you allow file uploads in your app, a user might upload content that hurts other users. Our primary concern...

Rails: Fixing ETags that never match

Posted 11 months ago by Henning Koch.

Every Rails response has a default ETag header. In theory this would enable caching for multiple requests to the same...

ActiveRecord::Relation#merge overwrites existing conditions on the same column

Posted 11 months ago by Henning Koch.

In Ruby on Rails ActiveRecord::Relation#merge overwrites existing conditions on the same column. This may cause the relation to...

Project management best practices: Technical debt summary

Posted 12 months ago by Emanuel.

Maintaining larger projects makes it more difficult to balance refactoring and upgrade tasks according to its actual value. Consider to...

Rails: Composing an ETag from multiple records

Posted About 1 year ago by Henning Koch.

Rails offers the fresh_when method to automatically compute an ETag from the given record, array of records or scope...

Rails: Your index actions probably want strict_loading

Posted About 1 year ago by Henning Koch.

By activating strict_loading you force developers to address n+1 queries by preloading all associations used in the index...

Rails Partials

Posted About 1 year ago by Niklas Hä..

Rails partials have a lot of "hidden" features and this card describes some non-obvious usages of Rails Partials.

HTTP headers can only transport US-ASCII characters safely

Posted About 1 year ago by Henning Koch.

HTTP header values must only contain low-ASCII (7-bit) characters for safe transport. From RFC 7230: Historically, HTTP has...

Carrierwave: Custom file validations inside custom Uploaders

Posted About 1 year ago by Jakob Scholz.

Carrierwave's BaseUploader can have some validations that you can use by overriding a certain method, which's expected name...

How to reliably center (block) icons vertically with text

Posted About 1 year ago by Dominik Schöler.

vertical-align is hard. Have you ever wanted to vertically center an icon with text? This usually means "vertically align...

Timecop: reset after each test

Posted Over 1 year ago by Daniel Straßner.

Timecop is a great gem to set the current time in tests. However, it is easy to introduce flakyness to...

Jasmine: Mocking ESM imports

Posted Over 1 year ago by Henning Koch.

In a Jasmine spec you want to spy on a function that is imported by the code under test. This...

Heads up: network requests `Kernel#open` are not mocked with VCR

Posted Over 1 year ago by Michael Leimstädtner.

We usually rely on VCR and WebMock to prevent any real network connection when running our unit tests.

subscript, superscript and line-heights

Posted Over 1 year ago by Bruno Sedler.

By default subscript ( ) and superscript ( ) tags are styled with vertical-align: sub, respectively vertical-align: super by most browsers.

A modern approach to SVG icons

Posted Over 1 year ago by Tobias Kraze.

You have some SVG files you want to use as icons on your website. How would you embed them?

Using path aliases in esbuild

Posted Over 1 year ago by Tobias Kraze.

In esbuild, you usually import other files using relative paths: import './some-related-module' import `../../utils/some-utility-module` import `../../../css/some-css.sass` This is totally fine...

Jasmine: Creating DOM elements efficiently

Posted Over 1 year ago by Henning Koch.

Jasmine specs for the frontend often need some DOM elements to work with. Because creating them is such a common...

Jasmine: Cleaning up the DOM after each test

Posted Over 1 year ago by Henning Koch.

Jasmine specs that work with DOM elements often leave elements in the DOM after they're done. This will leak...

Chrome DevTools: Treasure (Overview)

Posted Over 1 year ago by Julian.

tl;dr The Chrome DevTools are a neat collection of tools for the daily work as a web developer. If...

Careful when using Time objects for generating ETags

Posted Over 1 year ago by Arne Hartherz.

You can use ETags to allow clients to use cached responses, if your application would send the same contents as...