makandra dev

Just found out about a great feature in Rails that seems to be around since Rails 2. Start a console...

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

relishapp.com

Sometimes you have a test expectation but actually want a better error message in case of a failure. Here is...

Warning: Because of (unclear) rounding issues and missing decimal places (see examples below), do NOT use this when dealing with...

dev.mysql.com

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

makandra dev

We have released Modularity 2. It has many incompatible changes. See below for a script to migrate your applications automatically...

When a Ruby block or proc takes multiple parameters, and you call it with an Array, Ruby will unexpectedly splat...

Sometimes you need to monitor a connection from your machine to a specific, single host or network in order to...

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...

Today I ran into trouble installing therubyracer on Ruby 1.8. The installation failed with *** extconf.rb failed *** Could not create Makefile...

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...

So you client has asked you to implement a row of buttons to like the URL on Facebook, Twitter and...

I recently experienced the error ActiveRecord::StatementInvalid: Mysql2::Error: closed MySQL connection. Apparently this happens when there is a timeout...

After running bundler / gem install I could not load nokogiri lately. It died with cannot load such file -- nokogiri/nokogiri.

In order to keep the controllers directory tidy, we recently started to namespace controllers. With the :controller option you can...

web.archive.org

Capistrano 2 brings the shell command which allows you to run commands on your deployment targets. There is also invoke...

Simply give the select helper an option :disabled, passing either a single value or an array. You need to specify...

jimneath.org

The linked page lists and explains global Ruby "dollar" variables, such as: $: (load path) $* (ARGV) $? (Last exit status) $$ (PID) $~ (MatchData...

Ruby 1.9 brings a shorter way to define lambdas using the -> operator: twice = -> (x) { 2 * x } twice.call(5) # => 10

Connect to your memcached host. (AWS elasticache is memcached) telnet foohost23.cs2631.0001.euw1.cache.amazonaws.com 11211 Once you're connected, find out which 'slabs...

1. Saving files to a directory that is not shared between deploys or servers If you save your uploads to...

This card shows how to upgrade a Rails 2 application from Rails 2.3.8 through every single patch level up to...

The Rails secret_token must be unique for each application and any instance of it. If not, someone could exploit...