updating code to rails 4.2