2010-12-08 5 views
0

notes 모델에 users 모델과 다 대다 관계가 있습니다. notes 컨트롤러의 temp_path 행동을 가리키는양식 제출시 이상한 레일스 동작

<form id='note_form' method="post" action="/notes/temp_path" > 
    <input type="hidden" name="authenticity_token" value="<%= form_authenticity_token %>" />   
    <input type="text" size="30" name="start_date" id="start_date"> 
</form> 

다음 notes 컨트롤러의 인덱스보기에서 나는이 양식을 가지고있다. 어떤 이유로이 양식을 제출할 때 temp_path 액션에서 코드를 실행하는 대신 레일스가 특정 노트를로드하려고 시도하고 있으며 실행할 수 없기 때문에 인덱스로 다시 리디렉션됩니다.

Started POST "/notes/temp_path" for 127.0.0.1 at 2010-12-08 22:08:25 +1000 
DEPRECATION WARNING: Setting filter_parameter_logging in ActionController is deprecated and has no longer effect, please set 'config.filter_parameters' in config/application.rb instead. (called from <class:ApplicationController> at /Users/ben/rails_projects/note_prog/app/controllers/application_controller.rb:6) 
    Processing by NotesController#temp_path as HTML 
    Parameters: {"authenticity_token"=>"Ck6NmmYO86rvJSEsiqpIMkcaiErEhV7s/XMzjka15AI="} 
    User Load (0.3ms) SELECT "users".* FROM "users" WHERE ("users"."id" = 56) LIMIT 1 
    UserNote Load (0.2ms) SELECT "user_notes".* FROM "user_notes" WHERE ("user_notes"."note_id" = 0) 
Redirected to http://localhost:3000/notes 

나는 WHERE ("user_notes"."note_id" = 0) 비트가 문제의 원인입니다. 그러나 이것이 왜 완료되고 있는지 나는 잘 모르겠다. 그것 위에있는 라인을 기반으로, User Load (0.3ms) SELECT "users".* ... 그것은 Rails에 관한 것 같습니다. temp_path 액션에서 아무 것도 기존 노트를로드해야합니다. 이걸 어떻게 막을 수 있니? 레일즈 3.0.1을 사용하고 있습니다. 읽어 주셔서 감사합니다.

답변

1

컨트롤러 코드를 알려주십시오. 거기에 'redirect_to'문이 있습니까? 어떤 조건으로?

컨트롤러에 어쩌면 ApplicationController에 필터가있을 수 있습니까? Deprecation 경고에서 일부 코드가있을 수 있습니다.