Rails3.0 porting with new format route

rebased #798.