rest 시스템에서 조건부 GETting에 대한 지원을 구현하려고 시도하면서 new_when과 stale을 발견했습니다. 행동 양식. ? (: ETAG => 자원 : LAST_MODIFIED => resource.updated_at.utc) 오래된 경우 :ruby의 fresh_when이 xml 렌더링과 함께 작동하지 않습니다.
다음 코드는 304이 아니라 더 렌더링과 함께 잘 작동 할 respond_to | 형식 | format.html 번호의 show.html.erb } 끝 끝
그러나 1.xml에 액세스하는 두 배의 자원을 렌더링하기 위해 노력할 것입니다 :
if stale?(:etag => resource, :last_modified => resource.updated_at.utc)
respond_to do |format|
format.html # show.html.erb
format.xml {
render :xml => @order.to_xml(:controller => self, :except => [:paid_at])
}
end
end
오류 메시지 :
ActionController : : OrdersController의 DoubleRenderError # show
작업 당 한 번만 렌더링 또는 리디렉션 가능
RAILS_ROOT :/Users/guilherme/Documents/ruby / restfulie-test 응용 프로그램 추적 | 프레임 워크 추적 | 전체 추적
는/Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/base.rb:900:in render_without_benchmark' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/benchmarking.rb:51:in
은 ' /Library/Ruby/Gems/1.8/gems/activesupport 렌더링 -2.3.4/lib/active_support/core_ext/benchmark.rb : 17 : ms' /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/core_ext/benchmark.rb:10:in
실시간 ' /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/core_ext/benchmark.rb:17 : ms' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/benchmarking.rb:51:in
에서 렌더링 ' /도서관/루비/보석 /1.8/gems/actionpack-2.3.4/lib/action_controller/base.rb:1331:in send' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/base.rb:1331:in
perform_action_without_filters' /Library/Remy/Gems/1.8/gems/actionpack -2.3.4/lib/action_controller/filters.rb : 617 : call_filters' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/filters.rb:610:in
perform_action_without_benchmark ' /Library/Ruby/Gems/1.8/gems/actio npack-2.3.4/lib/action_controller/benchmarking.rb : 68 : perform_action_without_rescue' /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/core_ext/benchmark.rb:17:in
ms ' /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/core_ext/benchmark.rb:10 : in realtime' /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/core_ext/benchmark.rb:17:in
ms ' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/benchmarking.rb:68:in perform_action_without_rescue' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/rescue.rb:160:in
perform_action_without_flash' /Library/Ruby/Gems/1.8/gems/actionpack- 2.3.4/lib/action_controller/flash.rb : 146 : perform_action' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/base.rb:532:in
에 ' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/base.rb:532:in process_without_filters' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/filters.rb:606:in
프로세스'를 보내십시오. /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/base.rb:391:in process' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/base.rb:386:in
' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/ lib/action_controller/routing/route_set.rb : 4 37 : '전화 걸기'
어떤 제안이 있습니까?
감사
왜': controller => self'가'to_xml'에 전달 되었습니까? – BaroqueBobcat
휴식 ... github.com/caelum/restfulie –