2010-03-24 166 views
0

我刚开始写红宝石轨道。我写了一个控制器,但得到错误的数量的“参数(1为0)”的错误,我不明白为什么。它没有关于错误发生的信息?它有一个堆栈跟踪的完整列表,但我的控制器文件不在那里!红宝石轨道调试输出

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

我搜索谷歌的红宝石调试,我还没有发现任何有用的东西。

这里是我的控制器来源:

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' 

感谢您提前任何帮助。

回答

4

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

如果你想让你的URL看起来像.../send,你仍然可以在路由器中修复它。

+1

O,那就是为什么。谢谢。我仍然认为红宝石可能会给我一个有意义的消息 – Darkerstar 2010-03-24 08:16:03

+0

我想知道为什么rails使用'.send'而不是'__send__'。 – 2010-03-24 23:01:23