web.archive.org

xargs is a powerful bash tool that can take input from $STDIN and pass it to a given command. I.e...

There is no CSS selector for matching elements that contains a given string ¹. Luckily, Capybara offers the :text option to...

api.rubyonrails.org

Instantiating ActiveRecord objects comes expensive. To speed up things, you can choose a more direct way to talk to your...

api.rubyonrails.org

When working with custom transactions and use ActiveRecord::Rollback you may encounter unexpected behaviour if you try to roll back...

If you want to find the commits that touched a specific text in a file, use git log -S 'text...

davidverhasselt.com

Rails 5 / 6 / 7 Method Uses Default Accessor Saves to Database Runs Validations Runs Callbacks Updates updated_at/updated_on Respects Readonly...

Ruby's __FILE__ keyword returns the path to the current file. On popular for this are Ruby binaries: #!/usr/bin/env ruby...

When your controller action raises an unhandled exception, Rails will look at the exception's class and choose an appropriate...

PostgreSQL, unlike MySQL, treats strings as case sensitive in all circumstances. This includes comparison with = and LIKE collision detection in...

Is your application doing something expensive every few seconds? Maybe an animated slider that rotates images? Maybe you are updating...

By convention, common protocols use a defined port, like 80 for HTTP or 443 for HTTPS. You can use nmap...

When building a web application, one is tempted to claim it "done" too early. Make sure you check this list...

Chrome's developer tools automagically choose vertical or horizontal panel layout, based on their width. You can disable that magic...

PostgreSQL uses the C library's locale facilities for sorting strings: First, all the letters are compared, ignoring spaces and...

jakearchibald.com

The way that Javascript schedules timeouts and promise callbacks is more complicated than you think. This can be the reason...

As your Rails project grows, you will accumulate a number of small patches. These will usually fix a bug in...

relishapp.com

When you find yourself in the situation that you would like to define a custom matcher in your specs, but...

guides.rubyonrails.org

ActiveRecord offers an explain method similar to using EXPLAIN SQL statements on the database. However, this approach will explain all...

When dealing with time zones in Rails, there is one key fact to keep in mind: Rails has configurable time...

Expecting a primitive value as an argument to a method invocation is easy: expect(object).to receive(:foo).with('arg1...

This card existed before, but was outdated due to browser implementation changes. The information below is validated for the current...

RSpec provides a nice diff when certain matchers fail. Here is an example where this diff is helpful while comparing...

If you are on a Linux shell and want to open a file with whatever default application is configured for...

TL;DR There are three dimensions you can control when scoping routes: scope module: 'module', path: 'path', as: 'as' do...