fixing deprecation warnings for rails 4