extract render and redirect_to methods