User.joins(:answers)
.select('users.*','AVG(answers.score) AS average_score')User.joins(:answers)
.select_also('AVG(answers.score) AS average_score')--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-core/a6c37abb-1b91-4eea-978e-5a483c2e30a7%40googlegroups.com.
I like it, but I don't think it meets the criteria for inclusion in rails because it:
* Could easily be a gem.
* Is not meaningfully shorter.
* Requires the next person to read this code to know what this
method does.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-core/CAEUKiYH_JqVO4gAwdCXERqRPxsB2%2Bq5mkL4BJE4kfyWvvTNT_w%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-core/91dffc18-a1b6-9865-776e-2ec8d45d84b7%40heath.cc.
On 16 Nov 2019, at 12:43 am, Max Calabrese <max.f.c...@gmail.com> wrote:
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-core/CAH_9B3_UajjYomhL98k6YFUTDiUaqPnBfLpVWYaU9ZCB%3DqoztQ%40mail.gmail.com.