开发者

Sinatra, MongoMapper, and Builder wrong number of arguments (1 for 0)

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??


Sinatra 1.1.3 successfully fixed this error.

That is the only change in the environment

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜