Sinatra、MongoMapper 和 Builder 的参数数量错误(1 代表 0)
从 sinatra 路线调用构建器模板时出现此错误:
参数数量错误(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,我不会收到任何错误
听起来像是两个 gem 之间的问题?
I am getting this error when calling a builder template from sinatra route:
wrong number of arguments (1 for 0)
Sinatra - 1.1.2
Builder - 3.0.0
MongoMapper - 0.8.6
Calling it like this:
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
the builder file starts off like this:
xml.instruct!
Here's the full trace of the error:
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'
If I change Builder to 2.1.2, I receive no error
or
If I take MongoMapper out I receive no error
Sounds like an issue between two gems??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Sinatra 1.1.3 成功修复了这个错误。
这是环境唯一的改变
Sinatra 1.1.3 successfully fixed this error.
That is the only change in the environment