Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How can specify this ruby code in the lambda section
How can specify this ".sort_by{ |o| o.reviews.sum(:rating) }" in the lambda section
scope :sort_by_recommended, lambda{ }
Just like this :
scope :sort_by_recommended, lambda{ .sort_by{ |o| o.reviews.sum(:rating) } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment