updating code to rails 4.1