fix deprecation warnings in rails 4