Fix deprecation warnings from Rails4