Following some code in Agile Web Development book, theres a method to redirect back to the last viewed page using redirect_to(:back), however when I do that it simply returns back to the page it was on.
Whats the best way of getting the desired result to work? Am I doing something wrong? My code:
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