Fixed bug for rails version 3.2.11