2013-01-15 3 views
2

Rails 3.0.19 응용 프로그램에서 조각 캐싱을 구현하고 dalli을 캐시 저장소로 사용하려고합니다.조각 캐시가 고정 된 개체 오류 레일을 수정할 수 없습니다.

- @presentations.each do |p| 
    - cache "presentation", p do 
    = render_presentation_object p 

render_presetnation_object 실제로 일부 특정 일부 조건에 기초하여 렌더링 : 여기 내 캐시 조각 스크립트입니다. 스위퍼를 컨트롤러에 추가했습니다. 이 코드 @presentation.update_attributes(params[:presentation])를 사용하여 컨트롤러에서 어떤 일을 업데이트하려고하면 오류 ActiveRecord::StatementInvalid (RuntimeError: can't modify frozen object:

했다

class PresentationSweeper < ActionController::Caching::Sweeper 
    observe Presentation 

    def after_save(presentation) 
    expire_cache(presentation) 
    end 

    def after_update(presentation) 
    expire_cache(presentation) 
    end 

    def after_destroy(presentation) 
    expire_cache(presentation) 
    end 

    def expire_cache(presentation) 
    expire_fragment "presentation", presentation 
    end 
end 

은 내가 어떤 일이 있습니까 : 여기
cache_sweeper :presentation_sweeper, :only => [:create, :update, :destroy] 
caches_action :update 

는 스위퍼 코드입니다 실종 됐어?

+0

나머지 오류는 없습니까? – sevenseacat

+0

'ActiveRecord :: StatementInvalid (RuntimeError : 고정 된 개체를 수정할 수 없습니다. INSERT INTO 'user_logins'('email', 'sign_in_at') VALUES ('[email protected]', '2013-01-15 19:50 : 55 ')) : –

+0

프레젠테이션과 무슨 관계가 있습니까? – sevenseacat

답변

6

보석 랙 미니 프로파일 러 문제의 원인이었던 AR에 대한 런타임 변경이있었습니다. 그 보석을 제거하면 문제가 해결되며 모든 것이 훌륭하게 작동합니다.

+2

문제가 발생 했으므로 링크에서 자세한 업데이트를 확인하십시오. https://github.com/SamSaffron/MiniProfiler/issues/106 –

0

Nazar Hussain의 답변에 더 가깝습니다. 웹 사이트 URL 끝에? pp = disable을 추가하면 miniprofiler가 비활성화되어 Miniprofiler가 문제가되는 원인이 될 수 있습니다.