ruby - rails-how to update attributes based on time/day -


how update attributes in database based on time of day or day is. have 3 attributes energy, hunger, , happiness want decrease ten every hour don't quite know how go doing this. know there timestamps in database don't know how use them. want change players skills every day based on job. if have job, add 2 intelligence every day. don't know how add 2 every day. love if give me on problem. appreciate it.

a couple of options:

  • cronjob: setup cronjob access database directly through sql script (probably simplest solution out of in terms of setup) or go through rails application first (e.g. in case need run additional business logic before updating database - mentioned updating database based on user job). see post latter approach.

  • background task: take @ starling/workling or backgroundrb. can use either of these run background task update database @ regular intervals.


Comments