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?

When your public-facing application has a longer downtime for server maintenance or long migrations, it's nice to setup...

You need to set the :inverse_of option manually for relations that have an association to a polymorphic model. Otherwise...

After loading a staging dump into development, you might get an ActiveRecord::EnvironmentMismatchError when trying to replace the database (like...

When localizing model attributes via I18n you may run into errors like this: I18n::InvalidPluralizationData: translation data {...

...} can not be...

There are many approaches out there how you can import data from a legacy application to a new application. Here...

github.com

Use Traim to build a RESTful API for your ActiveRecord models with very little code. Traim assumes your API resources...

You can not use the hash_including argument matcher with a nested hash: describe 'user' do let(:user) { {id: 1...

ActiveRecord::RecordNotFound errors provide quite meaningful error messages that can provide some insight on application details. Consider the following:

This card will show you a cool way to define a class using Struct.new. A common usecase for Structs are...