How to make a limit points by month in Rails? -


in new rails project,i want limit user's post number point.at begining of every month,every user given limited points.when user use points,they can't thing.

my question is,how give user points @ begining of every month automatically in rails?how design model , controller?

thank you.

i think should use whenever schedule tasks. here 'monthly jobs syntax question' whenever mailing list. in general have like:

# shedule.rb every 1.month, :at => "beginning of month @ 3am"   runner "user.set_points" # or rake "task:for:user:set_poins" if have rake task end  # user.rb def self.set_points   user.all.each{|u| u.update_attribute(:points, some_function_to_calculate_points(u)} end 

i hope helps.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -