How to build a Time Trigger action?

I use a week-hits attribute for my article model to count weekly page
views.
I want this attribute to be set to 0 on every sunday 0:00.
How can I do that?

I use a week-hits attribute for my article model to count weekly page
views.
I want this attribute to be set to 0 on every sunday 0:00.
How can I do that?

In your article model define a method something like this:

def self.zero_week_hits

do whatever you need to do to zero them

end

Then via the command line you can run the following:

/path/to/rails_root/script/runner Article.zero_week_hits -e production

Put that line into your cron file to run every sunday at 0:00.

-philip

thanks! philip