Fixes deprecation warning in rails 4.