ruby on rails redirect_to(:back) not working
redirect, ruby-on-rails
Solution
I think it's behaving as intended:
:back - Back to the page that issued the request. Useful for forms that are triggered from multiple places.
Problem
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 ```