adaptation to rails4