RailsCasts Pro episodes are now free!
Learn more or hide this
GitHub User: orend
You probably want to replace
max = tags.sort_by(&:count).last
with
max = tags.max_by(&:count)
There's no need to sort the array only to pick the largest element.
You probably want to replace
max = tags.sort_by(&:count).last
with
max = tags.max_by(&:count)
There's no need to sort the array only to pick the largest element.