This would not work since you haven't defined a local variable `user_id` -- however, this code branch would never be run anyway, since there will never be a `params[:id]` in an index action.