缺少方法'to_query'的异常

时间:2010-10-25 11:40:48

标签: ruby

我正在尝试安装Ruby Bossman,并发生以下异常:

/opt/local/lib/ruby/gems/1.8/gems/bossman-0.4.1/lib/bossman/boss.rb:10:in `initialize': undefined method `to_query' for #<Hash:0x1010f0800> (NoMethodError)
    from /opt/local/lib/ruby/gems/1.8/gems/bossman-0.4.1/lib/bossman/search.rb:12:in `new'
    from /opt/local/lib/ruby/gems/1.8/gems/bossman-0.4.1/lib/bossman/search.rb:12:in `method_missing'
    from es.rb:12

任何想法?感谢

1 个答案:

答案 0 :(得分:3)

出现问题是因为Rails之外的Hash没有to_query方法。

我改变了

中的代码
/opt/local/lib/ruby/gems/1.8/gems/bossman-0.4.1/lib/bossman/boss.rb

通过更改一行:

@uri.query = @options.to_query

进入这个:

@uri.query = URI.encode_www_form(@options)