1

Hi I making a petition site. In my site i Have three types of petitions, every have self period. When period is passed it need to change petition status(integer value) automaticaly.

How to do this better? And wich time rails use on server, from my pc or from server? I ask about because I need somehow to test it manually.

I'm noviece, so if it's possible help me with simpliest alghoritm. I don't need a pure safety and performance.

TheVic
  • 303
  • 6
  • 16

1 Answers1

0

I would suggest implementing it as a rake task, that will run every day as a cron job and update the mentioned value if record matches the condition(exactly one year passed).

Using this way you avoid problems related to performance as the rake task launches in separate background and also you may run the task when your server isn't overloaded by other tasks, for example at night.

Following gem is useful to setup jobs by schedule https://github.com/javan/whenever

MikeZ
  • 485
  • 4
  • 13