lundi 16 octobre 2017

rails 3 making an API call when view is not open

My app is making twitter API calls. I call the function in my view and added in beginning of the view (index.htnl.erb):

 <head>
  <meta http-equiv="refresh" content="60">  <!-- update every 1mn -->
</head>    

So that the page is refreshed every minute and I can collect infos for my DB from the API call. I did not want to refresh all the views just this one (index.htnl.erb).
How can I have my function called the API when the index page is not open?

Aucun commentaire:

Enregistrer un commentaire