The git doc states on the difference of these two commands: git-restore[1] is about restoring files in the...
There are multiple ways to redirect URLs to a different URL in Rails, and they differ in small but important...
Sometimes you'll find yourself with a set of tasks that require similar code for different models. For example, if...
Splitting up commits makes the process of reviewing often easier, since you can create several merge requests or review every...
Within Capybara you most certainly use the #check- and #uncheck-method to (un)check checkboxes. But there's one problem...
Looking at the source code of the validates_numericality_of validator, it becomes clear that it converts the attribute in...
When you allow file uploads in your app, a user might upload content that hurts other users. Our primary concern...
In Ruby on Rails ActiveRecord::Relation#merge overwrites existing conditions on the same column. This may cause the relation to...
I found the linked article very helpful to refresh my understanding of database indexes. As a small bonus, it includes...
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...
We will achieve this by creating a block accepting method to optionally create and then lock a .lock File of...
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.
Since Rails 7 you are able to encrypt database information with Active Record. Using Active Record Encryption will store an...
To retrieve only unique combinations of the selected attributes: You can omit rows, where all selected columns are equal with...
When an object is created / updated, various callbacks are executed in this order: before_validation after_validation before_save
If you're frequently switching between projects, you might be annoyed by RubyMines behavior of opening the last project on...
If you're experiencing that your bundle install command fails with an error message like this, rubygems.org might...
Unpoly's [up-observe], [up-autosubmit] and [up-validate] as well as their programmatic variants up.observe() and up.autosubmit...
tl;dr Since Rails 7+ you can use ComparisonValidator for validations like greater_than, less_than, etc. on dates, numerics...