Ruby rails调试输出

时间:2010-03-24 07:56:04

标签: ruby-on-rails ruby debugging

我刚开始写ruby rails。我写了一个控制器,但错误的数量“参数(1为0)”错误,我不明白为什么。它没有关于错误发生位置的信息?它有一个完整的堆栈跟踪列表,但我的控制器文件不在那里!

在我的控制器中,我只有两种方法,我将测试activemq。但是在我把控制器拿出后,我得到了上面的错误,所以我注释掉了所有的代码,但是我仍然得到了同样的错误。我无法弄清楚原因。

我搜索谷歌的ruby调试,我没有找到任何帮助。

这是我的控制器来源:

class ActivemqTestController < ApplicationController
  def send
    #client = Stomp::Client.open("stomp://localhost:61613")
    #station_id=101
    #data = {'station_id' => station_id, 'username' => 'yangyanzhe'}
    #client.publish('/listener/add', data)
  end

  def receive
    #client = Stomp::Client.open("stomp://localhost:61613")
    # Processing loop
    #client.subscribe('/listener/add', headers) do |msg|
      # Process your message here
      # Your submitted data is in msg.body
      #puts msg['username'] + " joined " + msg['station_id'] + "\n"
      #client.acknowledge(msg)
    #end
    #client.join # Wait until listening thread dies
  end
end

这是错误:

ArgumentError in Activemq testController#index

wrong number of arguments (1 for 0)
RAILS_ROOT: D:/rubyapps/radio

Application Trace | Framework Trace | Full Trace
f:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:532:in `send'
f:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:532:in `process_without_filters'
f:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/filters.rb:606:in `process'
f:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:391:in `process'
f:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:386:in `call'
f:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/routing/route_set.rb:437:in `call'

感谢您提前提供任何帮助。

1 个答案:

答案 0 :(得分:4)

根据您的日志和Ruby的special .send方法(为所有对象定义),我建议您不要调用您的操作send。应该解决这个问题。

如果您希望自己的网址看起来像.../send,您仍然可以在路由器中修复此问题。