active-record-recipes
active-record-recipes copied to clipboard
Create an example that demonstrates how to return calculated results.
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