Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

Ian Drysdale's Profile

GitHub User: idrysdale

Comments by Ian Drysdale

Avatar

I ended up using:

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

Hope that helps.

Avatar

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

Avatar

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.

Avatar

Fantastic clip there, thanks for sharing.