I deliberately ask this question in an inflammatory way, because it bothers me that I'm missing something.
The Rails Way for working with updating the model is as follows:
class UsersController < ApplicationController ... def update @current_user = load_user if @current_user.update_attributes params[:user] redirect_to success_path else render :edit end end end
This is all good and good, except that you get to an odd url when the form is misrepresented:
User Editing
You get on the way:
users/:user_id/edit
After submitting changes that are not checked
i.e. you will need to correct the entries in the form and resubmit:
users/:user_id
After making changes that confirm
success_path
Why the hell should you be on a different url just because the form has errors?
Problem...
You do the same, but now you have a different url. It's a bit strange.
In fact, frankly this seems wrong. You are on a form that has not been validated correctly and therefore rebooted. You should still be at /users/:user_id/edit . If you did a JS check, you would do it.
Also, if you have some kind of “currently selected” logic in your navigation, you are actually not visually in the place where the correct navigation element is no longer highlighted - it looks like you are in the user’s profile page
source share