Reload instance data on instantiate

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

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,   Koke

try "initialize" and I believe it needs to be public. initialize is called my MyClass.new