Following some code in the Agile Web Development book, this method redirects back to the last page viewed using redirect_to (: back), however, when I do this, it just goes back to the page it was on.
What is the best way to get the desired result to work? Am I doing something wrong? My code is:
def update
@user = current_user
if @user.update_attributes(params[:user])
flash[:notice] = "Successfully updated profile."
redirect_to(:back)
else
render :action => 'edit'
end
end
source
share