Auto Page Refresh in Ruby on Rails

I'm new to Ruby on Rails, can anyone tell me how to refresh the page.

  • Without any value
  • With previous values โ€‹โ€‹presented
+6
ruby-on-rails
source share
2 answers

ActionView :: Helpers :: PrototypeHelper # periodically_call_remote :

  • Without any values โ€‹โ€‹provided

    <%= periodically_call_remote(:url => {}) %> 
  • With previous values โ€‹โ€‹that were resubmitted:

     <%= periodically_call_remote(:url => params) %> 

You can specify: a frequency option to indicate how often to call it.

You can also configure the format.js block in the controller to display an RJS template that will only update things that can change.

Edit: This approach was deprecated with Rails 3.0

This question (the equivalent of Rails 3 for periodic_call_remote ) provides a way to achieve this in new versions of Ruby on Rails.

+7
source share

You can also use the below script to automatically refresh the full page ...

SetTimeout ("location.reload ();", 10000);
0
source share

All Articles