Fixes for deprecation warnings in Rails 4.