When doing some meta-programming magic and you want to do something for all attributes of a class, you may...
In Rails, we usually have a mailer setup like this: class MyMailer < ActionMailer::Base def newsletter mail to: 'receiver@host.tld',
You can use .ids on an ActiveRecord 4+ scope to pluck all the ids of the relation User.where("users.name LIKE...
From at least Rails 4, the ActionView tag helper turns Array values of HTML options into a single space-separated...
RSpec >= 3.3 added aggregate_failures, which allows multiple failures in an example and list them all, rather than aborting on...
Today's cameras create huge images, some beyond 50MB. Unless you need to offer this large files, you should always...
Class-level process definitions are only applied to the original file Versions are generated based on the processed original file...
Spammers have started abusing other application to send their spam. This works like this: The application has some form that...
When restoring a PostgreSQL dump using pg_restore, you usually add the --clean flag to remove any existing data from...
When building an application that sends e-mails to users, you want to avoid those e-mails from being classified...
The standard way to abort async code is that your function takes a AbortSignal { signal } property. The caller can use...
To restart all tasks monitored by God, don't use god restart. This command is only meant to soft-restart...
To reload a single-item association in Rails 5+, call #reload_ : post.reload_author In older Railses you can say
When projects run for many years, they require special regular maintenance to stay fresh. This kind of maintenance is usually...
There are two ways to lock a user in devise. Using the lockable module Customizing the user account status validation...
When you are using lambdas in RSpec to assert certain changes of a call, you know this syntax: expect { playlist.destroy...
This repository was created with the intention of helping developers master their concepts in JavaScript. It is not a requirement...
Setting array columns When using PostgreSQL array columns, you can set an array attribute to a value with square brackets...
Percent Notation We already know that that we can create strings using the percent notation: %(<foo="bar's ton">) is...
It is very common to parse dates from strings. It seems obvious to use Date.parse for this job. However this...
Mobile Chrome and Safari support the "web share API" which allow you to use the native share functionality of an...
When debugging your application, you will come across objects created by some gem or framework. You don't have the...
Scrolling overflowing elements with JavaScript HTML elements with overflow-y: auto or overflow-y: scroll will get a scrollbar when...
Phusion Passenger changed the way how it gets restarted several times. Through the project's history, these all were valid...