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...
By default most exceptions in Rails will render a 500 error page and will create a new issue in your...
Rails Active Support provides some helpful methods for calculating times and dates, like Duration#ago or Duration#from...
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...
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...
To retrieve only unique combinations of the selected attributes: You can omit rows, where all selected columns are equal with...
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
tl;dr You should decouple migrations from models by embedding models into the migration. To use STI in this scenario...
Hat man mehrere Cloud Platformen und OnPremise Systeme, müssen diese unter Umständen miteinander verbunden werden. Amazon bietet eine Auswahl an...
ActiveType::Object inherits from ActiveRecod::Base and is designed to behave like an ActiveRecord Object, just without the database...
To allow HTTP 304 responses, Rails offers the fresh_when method for controllers. The most common way is to pass...
Greg Molnar has written a neat article about creating a single-file Rails app. This is not meant for production...
I recently wanted to add a model for address information but also wanted to add a unique index to those...
Imagine these models and associations: class Deck < ApplicationRecord has_many :cards end class Card < ApplicationRecord belongs_to :deck, optional: true...
There is a way to use multiple databases in Rails. You may have asked yourself how you're able to...
tl;dr You can use attribute? as shorthanded version of attribute.present?, except for numeric attributes and associations. Technical Details
If you're using many terraform root modules in a repository, downloading common providers like the AWS one can quickly...
RSpec's let allows you to super into "outside" definitions, in parent contexts. Example: describe '#save' do subject { described_class.new(attributes...