Sinatra、MongoMapper 和 Builder 的参数数量错误(1 代表 0)

发布于 2024-10-14 15:10:04 字数 1571 浏览 4 评论 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一场信仰旅途 2024-10-21 15:10:04

Sinatra 1.1.3 成功修复了这个错误。

这是环境唯一的改变

Sinatra 1.1.3 successfully fixed this error.

That is the only change in the environment

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文