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

Our development process makes us deploy very often. As the number of releases grows, junk clogs up the hard drive...

When you need to find out in which kind of spec you are during run-time, it's definitely possible...

makandra dev

git shortlog -s -n [commit-range] -n, --numbered Sort output according to the number of commits per author

Option 1: Creating a self-signed certificate with the openssl binary As igalic commented on this gist. openssl req -new...

This trick might be useful to implement more complicated directives in AngularJS. I needed it to do drag'n'drop...

Rails gives you migrations to change your database schema with simple commands like add_column or update. Unfortunately these commands...

Be careful with the Active Record where method. When you accidentally pass an empty array to the where method using...

In specs, the session never persists but is always a new object for each request. Data put into the session...

Find out in this short guide, how to horizontally center a absolute positioned container with CSS. Note: We have a...

view_context.helper_method('args') Rails 2 ApplicationController.helpers.helper_method('args') Also see How to use helper methods inside a model...

The way Rational#to_s works on Ruby has changed from Ruby 1.9 on. Here is how to get the...

Unfortunately, Capybara does not offer a switch to disable cookies in your test browser. However, you can work around that...

Rails flashes (FlashHash) track a list of used keys, which is not respected when comparing flash hashes.