TLDR: Ruby class variables (@@foo) are dangerous in many ways. You should avoid them at all cost. See bottom of...

w3.org

You probably know that you can use CSS selectors to match against elements and their attributes, such as:

Ruby has two different ways to match the start and the end of a text: ^ (Start of line) and $ (End...

validates_uniqueness_of is not sufficient to ensure the uniqueness of a value. The reason for this is that in...

Calling bundle update GEMNAME will update a lot more gems than you think. E.g. when you do this...

Calling bundle update (without arguments) updates all your gems at once. Given that many gems don't care about stable...

makandra dev
relishapp.com

You can define methods in any example group using Ruby's def keyword or define_method method. These helper methods...

makandra dev

Basic error pages To add a few basic styles to the default error pages in Rails, just edit the default...

Git commits should be very deliberate, and only contain changes that you really want to be in there. In order...

When you have two models in a has_many, has_one or belongs_to association, the :inverse_of option in...

simple_format ignores Rails' XSS protection. Even when called with an unsafe string, HTML characters will not be escaped or...

Note: Modern Rails has two build pipelines, the asset pipeline (or "Sprockets") and Webpacker. The principles below apply for both...

Tempfiles get deleted automatically With the the ruby Tempfile class you can create temporary files. Those files only stick around...

In a nutshell: Use git rebase --onto target-branch source-commit target-branch means "branch you want to be based...

When deploying, Capistrano puts a REVISION file into your application's release directory. It contains the hash of the commit...

Sometimes you need to remove high Unicode characters from a string, so all characters have a code point between 0...

Recent rails security updates have shown that people make incorrect assumptions about the possible contents of the params hash.

If you're suffering from a huge de.yml or similiar file, cry no more. Rails lets you freely organize your...

Localizing a non-trivial application can be a huge undertaking. This card will give you an overview over the many...

When requests arrive at the application servers simultaneously, weird things can happen. Sometimes, this can also happen if a user...

By default, Google Analytics tracks the current URL for every request. Sometimes you will want to track another URL instead...

An association defined with has_many :through will return the same record multiple times if multiple join models for the...

You can change which branches will be pushed when saying git push. Our recommendation is to set it to current...

robots.thoughtbot.com

TL;DR {} binds stronger than do … end (as always in Ruby, special characters bind stronger than words) Demo