How can I reload the current page in Ruby on Rails?

EverTheLearner picture EverTheLearner · Sep 19, 2011 · Viewed 80.5k times · Source

I currently have a login popup in my header bar which is on every page in my website. I want to be able to reload the current page that the person is on after a successful login. How do I do this in the controller?

def create
  #declaring and defining user variable stuff
  if user.save
    #reload current page <--how do I do this?
  end
end

Thanks

Answer

datalost picture datalost · Sep 19, 2011

For my application, I use redirect_to :back and it does the trick. However, I doubt this might have an error in a non general use case(s) (user came from a special page?) but i haven't found it so far in my app.