Mic*_*ant 6 ruby methods gem class httparty
我的系统上有HTTParty gem,我可以在rails中使用它.
现在我想独立使用它.
我在尝试:
class Stuff
  include HTTParty
  def self.y
    HTTParty.get('http://www.google.com')
  end 
end
Stuff.y
但我明白了
$ ruby test_httparty.rb 
test_httparty.rb:2:in `<class:Stuff>': uninitialized constant Stuff::HTTParty (NameError)
        from test_httparty.rb:1:in `<main>'
07:46:52 durrantm Castle2012 /home/durrantm/Dropnot/_/rails_apps/linker 73845718_get_method
$ 
Ste*_*fan 15
你必须require 'httparty':
require 'httparty'
class Stuff
  include HTTParty
  # ...
end
| 归档时间: | 
 | 
| 查看次数: | 6855 次 | 
| 最近记录: |