Revert "fix for rails4"

This reverts commit 4b3123304f49d18eea90867fed4be85698b45eb2.
Revert "Revert "fix for rails4""

This reverts commit d431a48cb8cabe8d826b5549ec24252d2fe6d1bf.