rails 4 refactoring