I am generating a web page that will ultimately display a lot of content--perhaps something like 50 categories each with 20 subjects each with 10 photos. I am devising a caching strategy both at the database layer and the UI layer, but I had a question about the former I want to pose to the experts here.
So the association would look something *display.categories.subjects.photos. *It seems to me just eyeballing that *display.categories.subjects* will be an expensive call I would like to cache. Imagine the following category model: class Category include DataMapper::Resource property :id, Serial ... has n, :subjects def subjects Rails.cache.fetch(self.id) { attribute_get(:subjects) #or something } end end Basically I want to override *subjects* so that I grab the cache of it if available. Otherwise, execute *subjects* as it would normally without the override to return the association from a database query. However, no matter what I try-- attribute_get, super, various combinations of each--I can't manage to solve this. I really don't want to have a second method to expose the cached association and betray those implementation details to my client code. Any ideas on this are appreciated. Thanks. -- You received this message because you are subscribed to the Google Groups "DataMapper" group. To unsubscribe from this group and stop receiving emails from it, send an email to datamapper+unsubscr...@googlegroups.com. To post to this group, send email to datamapper@googlegroups.com. Visit this group at http://groups.google.com/group/datamapper?hl=en. For more options, visit https://groups.google.com/groups/opt_out.