updating code to rails4