RailsCasts Pro episodes are now free!

Learn more or hide this

Ian Drysdale's Profile

GitHub User: idrysdale

Comments by Ian Drysdale


I ended up using:

def self.open
  joins(:events).where("user_events.id IN (SELECT MAX(id) FROM user_events GROUP BY user_id) AND state = 'open'")

Hope that helps.


I'd be interested to hear more about how you're approaching aggregation. I've started implementing an activity stream and am running into this challenge now.

Also, I'm trying to think of a good design pattern for how comments on aggregate stories should work. You can see more here: http://stackoverflow.com/questions/16339228/how-to-approach-aggregating-actvities-in-feeds-and-then-handling-comments


Yeah - I'm experiencing this too. I tweaked the code but now it appears to finds all the orders that are both in that state currently, or have at some point been in that particular state, which isn't quite working either.


Fantastic clip there, thanks for sharing.