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
는 스위퍼 코드입니다 실종 됐어?
나머지 오류는 없습니까? – sevenseacat
'ActiveRecord :: StatementInvalid (RuntimeError : 고정 된 개체를 수정할 수 없습니다. INSERT INTO 'user_logins'('email', 'sign_in_at') VALUES ('[email protected]', '2013-01-15 19:50 : 55 ')) : –
프레젠테이션과 무슨 관계가 있습니까? – sevenseacat