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 :

  • ->
  • require filename -> require filename.to_s

Some example commits from other projects :


  • tea42

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

  • Post a Comment