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

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

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

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

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

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

github.com

ActiveType::Object inherits from ActiveRecod::Base and is designed to behave like an ActiveRecord Object, just without the database...

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

wpostats.com

Case studies and experiments demonstrating the impact of web performance optimization (WPO) on user experience and business metrics.

To allow HTTP 304 responses, Rails offers the fresh_when method for controllers. The most common way is to pass...

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

greg.molnar.io

Greg Molnar has written a neat article about creating a single-file Rails app. This is not meant for production...

When working with feature branches, stale branches pile up over time. It's best to remove them right after merge...

Recently we detected a memory leak in one of our applications. Hunting it down, we found that the memory leak...