active-record-recipes icon indicating copy to clipboard operation
active-record-recipes copied to clipboard

Create an example that demonstrates how to return calculated results.

Open stevepolitodesign opened this issue 2 years ago • 0 comments

It could be fun to explore how to use pluck to return calculated results. Something like the following:

Chef.with_average_rating
# => [#<Chef id: 1, average_rating: 4.5>, #<Chef id: 2, average_rating: 3.0>]

Chef.first.average_rating
# => 4.5

stevepolitodesign avatar Jun 08 '22 18:06 stevepolitodesign