2014-10-23 3 views
0

의 원인 I가

응용 프로그램/자산/자바 스크립트/drill.js.coffee

... 
$('document').ready -> 
    if $('#x_eval_assum').length == 1 
    $('#x_eval_assum') 
     .submit (event) -> 
     event.preventDefault() 
     data = $("#x_eval_assum").serialize() 
     drill_id = $('.form.assumption').attr('data-drillid') 
     $.post "/drills/#{drill_id}/discovery_target_saved.json", data, (res)-> 
      console.log(' here ') 
     .change (event) -> 
     event.preventDefault() 
... 

응용 프로그램/컨트롤러/drills_controller.rb

나는이 오류 POST .. 호스트를 참조 개발자 도구 콘솔에서
... 
    def discovery_target_saved 
    load_evaluation_assumption_selections 
    load_user_positions 
    render :json, {data: @drill.id} 
    end 

: 3000/훈련// discovery_target_saved.json (500) (13) (내부 서버 오류)

몇 가지 변형을 시도해 보았습니다 - 내가 뭘 잘못하고 있니?

더 많은 물건

모두 "load_evaluation_assumption_selections"와 "load_user_positions는"제대로 작동하고 다른 드릴 작업에서 사용하는 드릴 컨트롤러 작업입니다.

내가 현재 가지고있는 내부 스터링에 특별히

Completed 500 Internal Server Error in 46ms 

ActionView :: MissingTemplate 보여주는 또 다른 오류 - {와 템플릿 훈련을 누락/JSON, 응용 프로그램/JSON : 로케일 => [: EN] : 형식을 => [: json], : variants => [], : 핸들러 => [: erb, : 빌더, : 원시, : 루비, : jbuilder, : 커피]}. 검색된 결과 : * "/ Users/davidlee/drill_investor/app/views" * "/Users/davidlee/.rvm/gems/ruby-2.1.1/gems/devise-3.4.0/app/views" : actionview (4.1.6) lib/action_view/path_set.rb : 46 : find' actionview (4.1.6) lib/action_view/lookup_context.rb:124:in 찾기

+0

서버 콘솔에 일부 출력이 있습니까? 'load_evaluation_assumption_selections'과'load_user_positions'에서 무엇을하고 있습니까? 당신 측에서 충분한 정보가 없기 때문에 우리는 질문에 대답 할 수 없다고 생각합니다. – Robin

+0

컨트롤러에'@ drill'이 설정되어 있습니까? 그렇지 않다면'@ drill'에서'.id'를 호출 할 때'no method error'를 얻을 것입니다 – John

+0

또한, 귀하의 URL이 작동 할 지 확신하지 못합니다. $ .post 줄을이 버전으로 바꾸어보십시오 :'$. post "/ drills/# {drill_id}/discovery_target_saved", 데이터, (res) -> console.log ('here'), "json"' – John

답변

0

앱에서 :json이라는보기 템플릿을 찾고 있습니다. 컨트롤러에서 다음을 시도해보십시오.

def discovery_target_saved 
    load_evaluation_assumption_selections 
    load_user_positions 
    render json: {data: @drill.id} 
end