uninitialized constant Twitter (NameError)

后端 未结 2 1850
梦谈多话
梦谈多话 2021-01-22 00:13

Hey guys i have a problem i am facing with the twitter gem. I have a file (twitter.rb) with this content

require \"rubygems\"
require \"twitter\"

puts Twitter.u         


        
相关标签:
2条回答
  • 2021-01-22 00:22

    If you are running Ruby 1.8.x you should be able to solve your problem by renaming your own script to anything different than twitter.rb.

    This is because the main file in the twitter gem is named exactly like this and your file probably overrides it in combined virtual file system that the $LOAD_PATH order creates. Before Ruby 1.9.x, require did not only load from library directories, but preferred to load files relative to the current working directory of your process, in this case, the directory where your script lies in.

    0 讨论(0)
  • 2021-01-22 00:37

    Do not name your file as twitter.rb, also make sure there is no other file in the same directory with the name twitter.rb

    0 讨论(0)
提交回复
热议问题