Haml 6 was a major rewrite with performance in mind. To achieve a performance improvement of 1.7x, some design...
Usually you add errors to :base in ActiveRecord, in case no appropriate attribute could be used to add the error...
Let's say we have posts with an attribute title that is mandatory. Our example feature request is to tag...
Rails Active Support provides some helpful methods for calculating times and dates, like Duration#ago or Duration#from...
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...
The change_column method for rails migrations support casting with a custom SQL statement. This allows us to change a...
This is a checklist I use to work on issues. For this purpose I extracted several cards related to the...
Rails partials have a lot of "hidden" features and this card describes some non-obvious usages of Rails Partials.
In the past we validate and set default values for boolean attributes in Rails and not the database itself.
Carrierwave's BaseUploader can have some validations that you can use by overriding a certain method, which's expected name...
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...
To retrieve only unique combinations of the selected attributes: You can omit rows, where all selected columns are equal with...
Let's assume that we have a model Movie that registers a callback function when a new instance of Movie...
Using ActiveRecord's #signed_id and .find_signed methods you can create URLs that expire after some time. No conditionals...
When an object is created / updated, various callbacks are executed in this order: before_validation after_validation before_save
TLDR if you define a equality method for a class you must also implement def hash. Ruby has a lot...
The cards editor has a feature "Cite other card" to create links to other cards in the same deck as...
tl;dr You should decouple migrations from models by embedding models into the migration. To use STI in this scenario...
Jasmine specs for the frontend often need some DOM elements to work with. Because creating them is such a common...
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...
ActiveType::Object inherits from ActiveRecod::Base and is designed to behave like an ActiveRecord Object, just without the database...