I'm looking to compare yesterday's activity versus today's as follows: class User include DataMapper::Resource property :id, Serial property :name, String property :denormalized_posting_stats, Integer property :updated_at, DateTime
has n, :postings end class Posting include DataMapper::Resource property :id, Serial property :posting_stats, Integer property :created_at, DateTime end You get the idea. Anyhow, the idea is that I denormalize the most recent stats so I can sort by them with less pain (maybe there's a better way). But... what I need to do is something like: User.all(:order => [:denormalized_posting_stats.desc]).each do |user| current = user.postings.last previous = user.postings.reverse[1] delta_posting_stats = current.posting_stats - previous.posting_stats report_on current, previous, delta_ posting_stats # fictitious reporting method end So this is ok, but maybe not wonderful but it seems suspiciously like it deserves a finder method. But I can't figure out how to concoct one. Any ideas? Thanks --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "DataMapper" 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/datamapper?hl=en -~----------~----~----~----~------~----~------~--~---
