Get ready for rails4.

Stop using features which are deprecated or removed in rails4.
last is better than to_a.last
Merge pull request #2 from square/jkingdon/rails4-readiness

Get ready for rails4.