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

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

github.com

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

The change_column method for rails migrations support casting with a custom SQL statement. This allows us to change a...

makandra dev

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

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

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

Sometimes I ran across a GitHub merge request of a gem where it was not completely obvious in which version...

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

thepugautomatic.com

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

makandra dev
ruby-doc.org

TLDR if you define a equality method for a class you must also implement def hash. Ruby has a lot...

makandra dev

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

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

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

blog.logrocket.com

Variable fonts are popular for two reasons: they expand design possibilities and improve website performance. While the former statement is...

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

tl;dr In Chrome DevTools in the Elements tab or in Firefox in the Inspector tab you can right click...

Unpoly's [up-observe], [up-autosubmit] and [up-validate] as well as their programmatic variants up.observe() and up.autosubmit...

makandra dev

tl;dr git checkout is the swiss army of git commands. If you prefer a semantically more meaningful command for...

You have uncommited changes (you can always check by using git status), which you want to discard.

tl;dr In RubyMine you can use find and replace with capture groups (.*?) and backreferences $1 (if you have several...

workingdraft.de

The robots.txt file and HTML tag can be used to control the behavior of search engine crawlers. Both have different...

A memory leak is an unintentional, uncontrolled, and unending increase in memory usage. No matter how small, eventually, a leak...

For Rails models where only one of multiple attributes may be filled out at the same time, there is no...