[V4] Rails3 backporting to Rails2

New pull request of #292.