我有一个闪存通知导致cookie溢出错误:
candidates = Hiring::Candidate.find(params[:candidate_ids])
notice = render_to_string(partial: '/hiring/candidates/new_candidates_assigned', locals: {candidate: candidates})
redirect_to path, notice: notice
我想这是因为很多对象都传递给了flash。这怎么可以避免?
答案 0 :(得分:1)
只需设置要在控制器中显示的信息
即可redirect_to path, :notice => "Successfully assigned new candidate"
在视图中渲染部分并将闪光通知作为本地传递。
<%= render partial => '/hiring/candidates/new_candidates_assigned', :locals => {:flash_notice => flash[:notice]}%>