繁体   English   中英

Rails对View if-end语句的注释使Linux / Apache / FastCGI上的渲染更加混乱

[英]Rails Comments on View if-end statement screw up rendering on Linux/Apache/FastCGI

以下代码在Windows开发环境下可以运行,但在我的生产Linux / Apache2 / FastCGI env上不能运行。

在我看来rhtml文件:

<td id='first_column' class='column'>
       <% content_for :head do #DO NOT CACHE THIS content for : HEAD %>
            <%= stylesheet_link_tag('live_tree') %>
            <%= javascript_include_tag "live_tree" %>
       <%  end #content_for %>
       <div  id='contentpanel_13B'>
              <div id='category_howtos_container'>
                    <%= render :partial => 'howtos_for_category'%>
              </div>
       </div>
       <% cache('category_gadget'+I18n.locale.to_s) do %>
           <div class='main_container gadget' id='categories_container'> 
               <%= render :partial => 'categories' %> 
           </div>
       <% end %>
</td>

此代码不会在linux下呈现div contentpanel_13B ...我将此问题隔离到注释上了:

             <%  end #content_for %>

我在Rails 2.3.2和2.3.3下尝试了成功,没有任何提示吗?

可能是注释阻止了'%>'的解析

尝试将评论放在自己的行上


<%  end 
    #content_for 
%>

我在<% cache(...) do %>遇到了同样的问题,一些缓存的html <% end # some comment %>块,将注释放在自己的行上对我不起作用。 我必须做: <% cache do(...) %>一些缓存的html % end %><% some comment %>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM