I''m working on a website which interacts with Amazon web services.
I have an Item class which is a cache for amazon items. I''d like to
have the class instances to refresh data every day (Time.now -
item.last_updated > 1.day) but not sure how.
I''ve tried with
class Item < ActiveRecord::Base
# ...
private
def instantiate(record)
super
refresh_data!
logger.info "refresh test"
end
end
but nothing happens.
Any ideas on this? Is ''instantiate'' the method I''m
looking for?
Thanks,
Koke
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---
koke wrote:> I''m working on a website which interacts with Amazon web services. > > I have an Item class which is a cache for amazon items. I''d like to > have the class instances to refresh data every day (Time.now - > item.last_updated > 1.day) but not sure how. > > I''ve tried with > > class Item < ActiveRecord::Base > # ... > > private > def instantiate(record) > super > > refresh_data! > logger.info "refresh test" > end > end > > but nothing happens. > > Any ideas on this? Is ''instantiate'' the method I''m looking for? > > Thanks, > Koketry "initialize" and I believe it needs to be public. initialize is called my MyClass.new --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---