Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

Oren Dobzinski's Profile

GitHub User: orend

Comments by Oren Dobzinski

Avatar

You probably want to replace

ruby
max = tags.sort_by(&:count).last

with

ruby
max = tags.max_by(&:count)

There's no need to sort the array only to pick the largest element.