[V2] Rails 3.2 porting

New version of #301.