# 최근 활동 추출 사용자의 최근 활동 확인 하려면 어떻게 해야 할까요?
## 공통 자료구조 정의 ``` class ActivityProxy attr_accessor :object, :date def initialize(object, date) self.object = object self.date = date end end ``` ## 모델 별 쿼리 수행 ``` activity = [] activity += Post.all(:limit => 10, :order => "created_at DESC").map { |post| ActivityProxy.new(post, post.created_at) } # and so on with the other objects ``` ## 정렬 ``` activity.sort_by(&:field) # => here you have the sorted objects # and you can iterate them with activity.each do |proxy| proxy.object.id # ... end ``` ## 레퍼런스 + “merging” multiple models. To create a “recent activity” box (https://goo.gl/3fDNgA)