2010-03-24 10 views
0

루비 레일을 작성하기 시작했습니다. 나는 컨트롤러를 썼지 만 "인수 (1에 대해 0)"오류가 발생했습니다. 이유는 이해할 수 없습니다. 오류가 발생한 위치에 대한 정보가 없습니다. 그것은 스택 트레이스의 전체 목록을 가지고 있지만 컨트롤러 파일은 거기에 없습니다!루비 레일 디버그 출력

내 컨트롤러에는 activemq를 테스트 할 두 가지 방법이 있습니다. 하지만 컨트롤러를 뺀 후에 위의 오류가 발생하여 모든 코드를 주석 처리했지만 여전히 동일한 오류가 발생합니다. 나는 이유를 알 수 없다.

Google에서 루비 디버그를 검색했는데 도움이되지 않았습니다.

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' 

사전에 어떤 도움을 주셔서 감사합니다

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 

이 오류는 다음과 같습니다

여기 내 컨트롤러 소스입니다.

답변

4

로그 및 Ruby의 종류에 따라 special.send 메서드 (모든 객체에 대해 정의 됨)에 따라 send 액션을 호출하지 않는 것이 좋습니다. 문제를 해결해야합니다.

URL을 .../send처럼 보이게하려면 라우터에서도 수정할 수 있습니다.

+1

O, thats why. 고맙습니다. 아직도 루비가 의미있는 메시지를 보여줄 수 있다고 생각합니다. – Darkerstar

+0

레일즈가'__send__'보다는'.send'를 왜 사용하는지 궁금합니다. –