This is a short overview of things that are required to upgrade a project from the Asset Pipeline to Webpacker...

You can use .ids on an ActiveRecord 4+ scope to pluck all the ids of the relation User.where("users.name LIKE...

Webpacker is Rails' way of integrating Webpack, and version 4 has been released just a few days ago, allowing us...

For searching in large database tables we usually use PostgreSQL's fulltext search capabilities. While this works reasonably well for...

When restoring a PostgreSQL dump using pg_restore, you usually add the --clean flag to remove any existing data from...

When upgrading Rails versions -- especially major versions -- you will run into a lot of unique issues, depending on the exact...

When debugging your application, you will come across objects created by some gem or framework. You don't have the...

In this example we assume that not only the storage gem changes but also the file structure on disc.

github.com

Masonry is a famous library to dynamically arrange a grid of items that have different aspect ratio, like horizontal and...

If validations failed for a record, and you want to find out if a specific validation failed, you can leverage...

Migrating data from a legacy into a new system can be a surprisingly large undertaking. We have done this a...

Having a unique selector for an element is useful to later select it from JavaScript or to update a fragment...

Background information about session storage in Rails Rails has a default mechanism to store the session in the CookieStore. This...

When you need to store structured data (like Ruby hashes) in a single database column with ActiveRecord, a simple way...

When your application is running on a multi-server setup, application logs are stored per server (unless you choose a...

You might have some trouble running a Rails LTS 2 app with MySQL 5.7. If you don't want to...

When you have string contents (e.g. a generated binary stream, or data from a remote source) that you want to...

stackoverflow.com

mysql> SELECT @@global.version; +------------------+ | @@global.version | +------------------+ | 5.6.30 | +------------------+ 1 row in set (0,00 sec) MySQL 5.6 Reference Manual says "BLOB and TEXT...

Enumerable#all? returns true for an empty collection. This totally makes sense but you have to think about it when...

makandra dev
fontawesome.com

Font Awesome version 5 changed some icon names, and introduces new prefixes fab, far, and fas. There is a JavaScript...

TL;DR Use user.update!(remove_avatar: true) to delete attachments outside of forms. This will have the same behavior as...

To check which elements an ActiveRecord relation contains use the contain_exactly matcher. describe User do let!(:admin) { create(:user...

This is a small example on how you can check if your Postgres index can be used by a specific...

You should avoid using application models in your migrations. But how else could you create records in a migration?