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

blog.mastermind.dev

I found the linked article very helpful to refresh my understanding of database indexes. As a small bonus, it includes...

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

A lot of web applications require being called over https, which is a good thing. It's possible to configure...

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

DevOps Curriculum

In dieser Card machst du einige Übungsaufgaben um Linux Server mit Ansible zu verwalten. Da es vermutlich zu aufwendig ist...

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

When a nginx reverse proxy complains about upstreams sending too big headers, tweaking the buffers responsibly can help to prevent...

makandra dev

This is a checklist I use to work on issues. For this purpose I extracted several cards related to the...

makandra dev

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

geekytidbits.com

To retrieve only unique combinations of the selected attributes: You can omit rows, where all selected columns are equal with...

Du verstehst was eine Custom Resource ist und warum das nützlich sein kann. Du weißt, was ein Operator ist...

DevOps Curriculum

Mit SQL spricht man mit relationalen Datenbanken. Ziele Verstehe die folgenden SQL Befehle SELECT WHERE ORDER INNER JOIN, LEFT JOIN...

kukicola.io

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

To delete a specific redis-DB you need to use the FLUSHDB-command in combination with the SELECT-command. For...