Rails: Different flavors of concatting HTML safe strings in helpers
This card describes different flavors for concatting HTML safe strings in a helper method in Rails. You might want to...
How to handle when an HTML <video> element cannot autoplay
...HTML elements can automatically start playing when the autoplay attribute is set on them. Except for when they can not...
Using rack-mini-profiler (with Unpoly)
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
Note Using rem only ever makes sense when the root font size is dynamic, i.e. you leave control to the...
Problems with git submodules in Gitlab CI
If you are using git submodules in Gitlab CI, you might run into a "The project you were looking for...
Rails: Testing file downloads with request specs
tl;dr Prefer request specs over end-to-end tests (Capybara) to joyfully test file downloads! Why? Testing file downloads
Accessibility: Making non-standard elements interactive
A common cause of non-accessible web pages are elements that were made interactive via JavaScript but cannot be focused...
Heads up: You should always use "current_window.resize_to" to resize the browser window in tests
I recently noticed a new kind of flaky tests on the slow free tier GitHub Action runners: Integration tests were...
Use <input type="number"> for numeric form fields
Any form fields where users enter numbers should be an . Numeric inputs have several benefits over : On mobile or tablet...
Best practices: Writing a Rails script (and how to test it)
A Rails script lives in lib/scripts and is run with bin/rails runner lib/scripts/.... They are a simple tool to perform...
Element.animate() to animate single elements with given keyframes
Today I learned that you can animate HTML elements using the Web Animation API's method .animate(keyframes, options) (which...
Unpoly 3.7.1, 3.7.2 and 3.7.3 released
Version 3.7.0 broke some things in complex forms. Sorry for that. Concurrent user input is hard. 3.7.1 This change fixes...
RailsStateMachine 2.2.0 released
Added: State machine can now use the :prefix-option to avoid name collision if you define multiple state machines on...
Javascript: Avoid using innerHTML for unsafe arguments
Make sure that you use the correct property when editing an HTML attribute. Using innerHTML with unsafe arguments makes your...
A reasonable default CSP for Rails projects
Every modern Rails app should have a Content Security Policy enabled. Very compatible default The following "default" is a minimal...
How to: Upgrade CarrierWave to 3.x
While upgrading CarrierWave from version 0.11.x to 3.x, we encountered some very nasty fails. Below are the basic...
Zeitwerk: How to collapse folders in Rails
All direct child directories of app are automatically added to the eager- and autoload paths. They do NOT create a...
RSpec: Leverage the power of Capybara Finders and Matchers for view specs
View specs are a powerful tool to test several rendering paths by their cases instead of using a more costing...
Spreewald, Cucumber: Selector for the nth element
The recommended additional setup of the spreewald gem, a useful set of cucumber steps, includes adding a file for defining...
How to work around selenium chrome missing clicks to elements which are just barely visible
Chromedriver (or selenium-webdriver?) will not reliably scroll elements into view before clicking them, and actually not click the element...
HTML: Auto fill-in OTP received in text message (SMS)
Browsers can auto fill-in one time codes if advised. Use it like this: Demo: https://twitter.com/sulco/status/1320700982943223808 Browser support...
Lightning Talk: Coverage based Test Case Prioritization in Ruby on Rails
For my computer science bachelor's thesis I programmed and evaluated a CLI Test Case Prioritization (TCP) tool for makandra...
Do not pass params directly into url_for or URL helpers
Rails' url_for is useful for generating routes from a Hash, but can lead to an open redirect vulnerability.
RSpec: How to write isolated specs with cookies
Rails offers several methods to manage three types of different cookies along with a session storage for cookies. These...