RSpec: How to write isolated specs with cookies

Posted 9 months ago by Felix Eschey.

Rails offers several methods to manage three types of different cookies along with a session storage for cookies. These...

How to transition the height of elements with unknown/auto height

Posted 9 months ago by Arne Hartherz.

If you want to collapse/expand elements with dynamic content (and thus unknown height), you can not transition between height: 0...

Use -webkit-line-clamp to natively truncate long (multi-line) texts with an ellipsis

Posted 9 months ago by Dominic Beger.

Note: You won't need this for single lines of text. In this case it is better to just use...

How to find child nodes that match a selector with JavaScript

Posted 10 months ago by Arne Hartherz.

Using querySelector or querySelectorAll in JavaScript, you can easily find descendants of a node that match a given selector.

Checklist for Implementing Design

Posted 10 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...

Code splitting in esbuild: Caveats and setup

Posted 10 months ago by Henning Koch.

TL;DR Still has caveats. Code splitting is a feature of JavaScript bundlers that can keep huge libraries out of...

Better HTML forms: use type, inputmode, enterkeyhint and autocomplete

Posted 11 months ago by Dominik Schöler.
adactio.com

Web forms can be made much more usable with a few HTML attributes. Short summary: type: Tells browsers about the...

Preventing users from uploading malicious content

Posted 12 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...

We have deprecated Rack::SteadyETag

Posted 12 months ago by Henning Koch.

Rack::SteadyETag was a Rack middleware that generates the same default ETag for responses that only differ in XOR-masked...

Rails: Fixing ETags that never match

Posted 12 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...

Breaking changes for boolean attributes in HAML 6

Posted About 1 year ago by Emanuel.

Haml 6 has some breaking changes regarding boolean attributes. Only the following attributes and aria/data attributes are considered boolean attributes...

Simple Form: Rendering errors without an appropriate attribute

Posted About 1 year ago by Emanuel.

Usually you add errors to :base in ActiveRecord, in case no appropriate attribute could be used to add the error...

Rails: Assigning associations via HTML forms

Posted About 1 year ago by Emanuel.

Let's say we have posts with an attribute title that is mandatory. Our example feature request is to tag...

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...

How to enable template coverage support for simplecov

Posted About 1 year ago by Felix Eschey.
github.com

Since Ruby 3.2.0 you can measure coverage support for eval statements and support has been added for the simplecov gem...

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.

How to turn images into inline attachments in emails

Posted About 1 year ago by Klaus Weidinger.

Not all email clients support external images in all situations, e.g. an image within a link. In some cases, a...

Rails: Encrypting your database information using Active Record Encryption

Posted About 1 year ago by Emanuel.

Since Rails 7 you are able to encrypt database information with Active Record. Using Active Record Encryption will store an...

Rails: Accessing helper methods from a controller

Posted Over 1 year ago by Henning Koch.

In Rails 5+ you can access a helper from a controller using the helpers method: # Inside a controller action

Dynamic super-overridable methods in Ruby – The Pug Automatic

Posted Over 1 year ago by Henning Koch.
thepugautomatic.com

How a macro can dynamically define a method that can be overridden with super in the same class.

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...

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...