[V3] Rails 3.0 porting

New version of #299.