rails/rails — pull request #5564 by carlosantoniodasilva (2012-03-23 18:26:14+00:00)
Title: Fix build for branch 3-1-stable

Cherry-picked commits from 3-2. Please check #5557 and #5558 for detailed info.