updated for rails4