improved to rails4