You can implement a rake task that builds the data and initiate the task 
using CRON.

However, it really depends on what your idea of accumulated data is to 
be honest.  If a user is hitting your web page you can create an action 
that instantiates the loading and updates a database.  Or, if the data 
is something that is being accumulated through creations or updates, 
then you can use callbacks in your model to perform actions.

What type of data are you trying to accumulate?

Here's a brief example of something I created to tag when a person hits 
a view in my app:

class ApplicationController < ActionController::Base

protected

def instantiate_sitestats(page)
  site_stats = 
Sitestat.find_by_user_id_and_pages_visited(@current_user.id, page)
  if site_stats
    site_stats.update_attributes(:clicks => (site_stats.clicks + 1), 
:last_time_clicked => Time.now.in_time_zone)
  else
    Sitestat.create(:user_id => @current_user.id, :pages_visited => 
"#{page}", :clicks => 1, :last_time_clicked => Time.now.in_time_zone)
  end
end

end

.. then in each controller I want to mark this occurence I do:

def index
  instantiate_sitestats("Home Index") if user_signed_in?
end

This allows me to track any page a user visits, if the user is signed 
in.  You can create your own trackables as well.

If you are looking more for notifications, or internals, you might want 
to look at Rails' notifications, although some are heavy and intensive 
loads.

Otherwise, cron or model callbacks are your best bet.

Hope it helps.

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to