Get ready for rails4.

Stop using features which are deprecated or removed in rails4.