2010-03-24 163 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