When deploying a Rails application that is using Webpacker and Capistrano, there are a few configuration tweaks that optimize the...
IRB 1.2 (shipped with Ruby 2.7, but works on 2.5+) brings pretty syntax highlighting and multiline cursor navigation. However, pasting...
Git diffs show the surrounding contexts for diff hunks. It does so by applying regular expressions to find the beginning...
Sometimes you want to find the inverse of an ActiveRecord scope. Depending on what you want to achieve, this is...
On some of our older projects, we use the mysql2 gem. Unfortunately, versions 0.2.x (required for Rails 2.3) and...
It sometimes happen that a database dump, that would want to insert into your development database, does not match the...
If you're using the webdrivers gem and VCR together, depending on your configuration, VCR will yell at you regulary...
If a model inherits from others or uses many concerns / traits, it might be hard to see in the code...
When logging in Rails, you can use the log_tags configuration option to add extra information to each line, like...
If you want to get the path of a file relative to another, you can use the expand_path method...
Rails 5.2+ supports "verbose query logs" where it shows the source of a query in the application log.
In Ruby on Rails, all the routes of a given application can be found within the config/routes.rb file.
Rails middlewares are small code pieces that wrap requests to the application. The first middleware gets passed the request, invokes...
If you have a Ruby Pathname, you can use the method :/ to append filepaths to it. With this method, Ruby...
If you migrate a Rails application from Sprockets to Webpack(er), you can either transpile your CoffeeScript files to JavaScript...
CSP hat zum Ziel einen Browser-seitigen Mechanismus zu schaffen um einige Angriffe auf Webseiten zu verhindern, hauptsächlich XSS...
GoodJob is a new background worker gem. It's compatible with ActiveJob. We're huge fans of Sidekiq for its...
"Open-source software (OSS) is great. Anyone can use virtually any open-source code in their projects." Well, it depends...
If you have a :string or :text field, you should pair it with a model validation that restricts its length...
TL;DR PostgreSQL handles Rails 4+ text and string columns the same. Some libraries may still reflect on the column...
In a web application you sometimes have tasks that can not be processed during a request but need to go...
tl;dr Don't forget require 'English' if you use a named global such as $LAST_MATCH_INFO. Otherwise this...
We use the whenever gem to automatically update the crontab of the servers we deploy to. By default, whenever will...
Ruby and Rails have several methods for creating a new object that looks like another: clone, dup, deep_dup. When...