use reader which is supported in rails3 and rails4