从sinatra route调用构建器模板时出现此错误:
错误的参数数量(1表示0)
Sinatra - 1.1.2
Builder - 3.0.0
MongoMapper - 0.8.6
这样称呼:
get '/current_load.xml' do
@caption = "Load Average"
@sub_caption = "5 minutes"
@time = Performance.where(:NAGIOS_SERVICEDESC => "Current Load").fields(:NAGIOS_LONGDATETIME).all
content_type :xml
builder :current_load
end
构建器文件就像这样开始:
xml.instruct!
以下是错误的完整描述:
ArgumentError - wrong number of arguments (1 for 0):
/usr/lib/ruby/gems/1.8/gems/builder-3.0.0/lib/builder/xmlbase.rb:135:in `to_xs'
/usr/lib/ruby/gems/1.8/gems/builder-3.0.0/lib/builder/xmlbase.rb:135:in `_escape'
/usr/lib/ruby/gems/1.8/gems/builder-3.0.0/lib/builder/xmlbase.rb:140:in `_escape_quote'
/usr/lib/ruby/gems/1.8/gems/builder-3.0.0/lib/builder/xmlmarkup.rb:320:in `_attr_value'
/usr/lib/ruby/gems/1.8/gems/builder-3.0.0/lib/builder/xmlmarkup.rb:308:in `_insert_attributes'
/usr/lib/ruby/gems/1.8/gems/builder-3.0.0/lib/builder/xmlmarkup.rb:306:in `each'
/usr/lib/ruby/gems/1.8/gems/builder-3.0.0/lib/builder/xmlmarkup.rb:306:in `_insert_attributes'
/usr/lib/ruby/gems/1.8/gems/builder-3.0.0/lib/builder/xmlmarkup.rb:284:in `_special'
/usr/lib/ruby/gems/1.8/gems/builder-3.0.0/lib/builder/xmlmarkup.rb:250:in `instruct!'
/opt/nec/www/nec/views/current_load.builder:1:in `evaluate_source'
如果我将Builder更改为2.1.2,则不会收到任何错误 要么 如果我把MongoMapper拿出来我没有收到任何错误
听起来像两个宝石之间的问题??
答案 0 :(得分:1)
Sinatra 1.1.3成功修复了此错误。
这是环境中唯一的变化