Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.