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 :

8 comments:

  • tea42

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

  • Ahmad Abdullah

    Great Article! Keep posting such kind of information on your site Im really impressed by your site ;)

    Also I Have found very useful content for VHS to DVD transfer edmonton in Edmonton Canada you can visit the website here … www.azaudiovisualservices.com

  • Karen

    The NFL Flag for Tennessee Titans is viewable from both sides with the opposite side being a reverse image.Fly this flag with any of our tailgate poles or 6' aluminum flagpoles and adjustable flag brackets.
    nfl flags wholesale,
    house divided flags,Packers stars and stripes flags
    Houston Oilers stars and stripes flags

  • Karen

    Materiale: 100% poliestere
    La tecnologia ClimaCool conduce sudore e calore lontano dal corpo
    Ricamato logo adidas sul petto a destra
    Ricamato stemma della squadra sul petto a sinistra
    logo dello sponsor termosaldato sul petto
    “MUFC” è stampata in blu sul retro del collettomaglie calcio 2017,
    maglie calcio poco prezzo, Maglia real madrid a poco prezzo 2017
    nuove Maglia Atletico Madrid prezzo

  • Post a Comment