Fix Rails 4 deprecation errors.