Minor refactor - Uses Enumerable#to_a instead of iterate and add to an array

The [Enumerable#to_a](http://ruby-doc.org/core-2.0/Enumerable.html#method-i-to_a) do the same job as the iteration + array addition.

I also take to the opportunity to remove an unnecessary [white space](https://github.com/rails/rails/pull/11625/files#L2L122) and [empty line](https://github.com/rails/rails/pull/11625/files#L3L238).