Rails: why is calling to_a on a string not valid in a rake task?
To duplicate the 1.8.7 functionality:
1.8.7 > 'foo'.to_a # => ['foo']
You would use:
1.9.3 > 'foo'.lines.to_a # => ['foo']
The other answers suggest #chars, which is not the same:
1.9.9 > 'foo'.chars.to_a # => ['f', 'o', 'o']
In ruby 1.9, String no longer has a to_a
method. Your older code probably used Ruby 1.8, which did.
String objects do not have to_a
. See here:
http://ruby-doc.org/ruby-1.9/classes/String.html
You can use:
"foo".chars.to_a
Which results in:
["f","o","o"]