String#indent is not a standard Ruby method. When you use it, be sure to know where this method comes...

You might have a table without a primary key set in MySQL. You can fix this by adding a primary...

Usually, Cucumber feature files live in features/. When you group them in sub directories, make sure to add -r features...

robots.thoughtbot.com

Arel is a library that was introduced in Rails 3 for use in constructing SQL queries. Every time you pass...

class Book::Page end class MyBook < Book def new_page Page.new # has to be `Book::Page` in development to...

makandra dev
tech.taskrabbit.com

At TaskRabbit, we have gone through a few iterations on how we make our app(s). In the beginning, there...

makandra dev
robots.thoughtbot.com

Rails 4.0 introduced a helpful new method for ActiveRecord queries: where.not. It can make clunky queries easier to read.

dev.mysql.com

A MySQL DECIMAL column is used when it is important to preserve exact precision. It takes two parameters, where...

When you do something like this in your code: def var_value @var ||= some_expensive_calculation end

If you have a FooController and also have a layout app/views/layouts/foo.html, Rails will use this without being told so.

TLDR: This card explains which threads and processes interact with each other when you run a Selenium test with Capybara...

tl;dr: Using has_many associations with a :through option can lead to lost or duplicate records. You should avoid...

On recent/fresh installations of Ruby 1.8.7 you may encounter this error why calling any bundled binary (or just bundle exec...

We've since created ActiveType which has a restricted subset of Virtus' features. It might be enough for your needs...

In Ruby, classes and modules are called constants. This card explains how Ruby resolves the meaning of a constant.

Modern IRB has time measurement built in. measure # Enable measure :off # Disable Custom Should your version of IRB not offer...

stackoverflow.com

Before Rails 3.2.14, when supplying an invalid locale to I18n, it would fall back to its config.i18n.default_locale (which is...

Goal Within before_* Within after_* Cancel later callbacks throw :abort throw :abort Rollback the transaction throw :abort raise ActiveRecord::Rollback...

Ubuntu 12.04 LTS x64, Ruby 1.8.7, Rails 2.13, PDFKit 0.5.4, Phusion Passenger Apache 2 I ran into this, when I...

Whenever you create a table from a database migration, remember to add updated_at and created_at timestamps to that...

If you need to enable NewRelic monitoring on certain machines within the same Rails environment, a simple solution is to...

Ubuntu has a package mysql-sandbox that lets you install multiple MySQL versions into your user home: Install mysql-sandbox...

Rails has always included a scaffold script that generates a default controller implementation for you. Unfortunately that generated controller is...

It is good programming practice to Don't Repeat Yourself (or DRY). In Ruby on Rails we keep our code...