Created
December 4, 2014 11:56
-
-
Save AndrewVos/4c9bd2bd4166f03c237d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
activities = Activity.includes(:product) | |
.order("product_id, created_at DESC") | |
.select("DISTINCT ON (product_id) activities.*") | |
.page(page).per(second_page_size).map do |activity| | |
activity.product.activity = activity | |
activity.product | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment