페이지를 redirect_to하지 않습니다, 양식 (생활 잘) 오류에 그러나오류 성공
원격으로 제출하고 올바르게 index.js.erb를로드합니다 (다른 사람이) 아무 반응이 없습니다. 오류시 다른 파일을로드하거나 index.js.erb에 논리를 추가하고 싶습니다. 그러나, 그냥 실패하고로드되지 않습니다.
오류 자원을로드하지 못했습니다 : 서버가 구조
(을 구현 한 후 나는 그것이 아무튼 때문에 즉 이해, 내가 406 오류가 발생 알고 500 (내부 서버 오류)의 상태으로 대응 't은 이벤트를 찾을 수 있습니다,하지만 난 다시 사용자)
이벤트 컨트롤러를 알리는 모달를 표시 할 수 있도록 내가 보장 어떻게 내 index.js.erb-를로드
def index
respond_to do |format|
if @event = Event.find_by_event_code(params[:checkin])
format.html { redirect_to @event, success: "You have found your event" }
format.js
elsif @event = Event.find_by_speaker_code(params[:checkin])
format.html { redirect_to @event, success: "Welcome Super User. You have found your event" }
format.js
else
format.html { redirect_to @event, error: "No event by that event code" }
format.js
end
end
end
,691,363 (210)
index.js.erb
$("#checkin-popup").remove();
$("#checkin-confirm-popup").html("<%= escape_javascript(render("/events/index.html.erb")) %>")
$('#checkin-confirm-popup').modal('show');
button.html
<%= simple_form_for @event, remote: true ,:method => 'get' do |e| %>
<div class="talknumber"><%= text_field_tag :checkin, params[:search] %></div>
<%= e.button :submit, "Checkin", :class => "btn btn-default" %>
<% end %>
서버 로그
Started GET "/events?utf8=%E2%9C%93&checkin=1212122&commit=Checkin" for 127.0.0.1 at 2014-01-10 11:43:39 -0500
Processing by EventsController#index as JS
Parameters: {"utf8"=>"✓", "checkin"=>"1212122", "commit"=>"Checkin"}
(0.5ms) SELECT "users"."name" FROM "users"
Event Load (0.5ms) SELECT "events".* FROM "events" WHERE "events"."event_code" = 1212122 ORDER BY events.created_at ASC LIMIT 1
Event Load (0.4ms) SELECT "events".* FROM "events" WHERE "events"."speaker_code" = 1212122 ORDER BY events.created_at ASC LIMIT 1
Completed 406 Not Acceptable in 7ms (ActiveRecord: 1.4ms)
안녕하세요, 이제 구조 블록 시작을 시도했습니다. 이제 406 오류가 발생합니다. http : // localhost : 3000/events? utf8 = % E2 % 9C % 93 & 체크인 = dawdw12 & 커밋 = Checkin 406 (Not Acceptable) – RedRory
@ RedRory는 디버거에 익숙하십니까? 너 구출 블록에서 흐름을 멈추고 확인해 줄래? – arun15thmay
디버거를 설치하고 2 행에 배치했습니다. 그러나 "다음"을 시도 할 때. 그것은 나를 active_record/relation.rb와 다른 고수준의 방법으로 옮기고 말 그대로 "20 배로"넥서스하고 내 인덱스 작업에 결코 오지 않습니다. – RedRory