Rails character encoding issue while using cache

纵饮孤独 提交于 2020-01-04 06:15:50

问题


I am using rails fragemnet cache to cache some html.

Below is my code

  <% if @link.social_tags.present? %>
    <% cache(:action =>'pageui', :action_suffix => "#{@link.id}_tags") do %>
      <% @link.social_tags.each_with_index do |tag, index| %>
        <%= ", " if index > 0 %>
        <%= link_to tag.name, some_path(:tag => tag.id), :title => tag.name, :target => "_blank" %>
      <% end %>
    <% end %>
  <% else %>
    Still no tag for this Page.
  <% end %>

I am getting some weird issue. First time when it doesn't have the fragement cached, it gives error "incompatible character encodings: UTF-8 and ASCII-8BIT"

However subsequent request works fine. Only first request give the error.

Any hint?

来源:https://stackoverflow.com/questions/11114872/rails-character-encoding-issue-while-using-cache

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!