Fix Ruby 1.9 "can't convert Pathname to String (TypeError)" error

Thursday, November 24, 2011
Do you find yourself hitting this error when running your ruby code on ruby 1.9? Then on the line that actually tries to load the file (like the following examples) add the .to_s after what used to be the filename :

  • IO.read(filename) -> IO.read(filename.to_s)
  • require filename -> require filename.to_s
etc...

Some example commits from other projects :

1 comments:

  • tea42

    Why did this happen? Was #to_str removed from Pathname?

  • Post a Comment