foursquare api调用在带有quimby gem的heroku控制台中失败

时间:2011-12-29 17:16:13

标签: ruby-on-rails heroku foursquare

我正在使用quimby gem与foursquare的场地api连接。我有一个建立模型,我正在尝试运行一个方法,在foursquare上查找一个机构,这样我就可以用4sq提供的数据做事。

在我的建立模型中我创建了这个方法

def find_on_foursquare
  Foursquare.verbose = true
  foursquare = Foursquare::Base.new(FOURSQUARE_ID, FOURSQUARE_SECRET)
  begin 
    venue = foursquare.venues.search(:ll => "#{self.lat},#{self.long}", 
                             :query => self.name, 
                             :categoryId => '4d4b7105d754a06374d81259')['nearby'][0]
    puts venue
  rescue 
    puts 'FAILED!'
  end
end

当我从localhost控制台执行此操作时,一切运行顺利。但是,当我推送到heroku并尝试从heroku控制台执行时,它会因“!内部服务器错误”而失败

任何想法我做错了和/或如何调试这个?

来自heroku日志的一些奇怪的行:

2011-12-29T17:09:29+00:00 app[web.1]: [foursquare] GET https://api.foursquare.com/v2/venues/search
2011-12-29T17:09:29+00:00 app[web.1]: [foursquare] PARAMS: {"ll"=>"42.344432,-71.098326", "query"=>"Citizen", "categoryId"=>"4d4b7105d754a06374d81259"}
2011-12-29T17:09:29+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/typhoeus-0.3.3/lib/typhoeus/easy.rb:397: [BUG] Segmentation fault
2011-12-29T17:09:29+00:00 app[web.1]: ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux]

1 个答案:

答案 0 :(得分:0)

解决方案:我必须将Typhoeus降级到0.2.4,以便在部署在Heroku上时让Quimby宝石与Foursquare交谈。现在工作得很好。