简体   繁体   English

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

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

the following code does work under my Windows development environment, but not on my production Linux/Apache2/FastCGI env. 以下代码在Windows开发环境下可以运行,但在我的生产Linux / Apache2 / FastCGI env上不能运行。

in my view rhtml file : 在我看来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>

This code does not render the div contentpanel_13B under linux... I isolated the problem to the comment on this line : 此代码不会在linux下呈现div contentpanel_13B ...我将此问题隔离到注释上了:

             <%  end #content_for %>

I tried under Rails 2.3.2 and 2.3.3 without success... any hints? 我在Rails 2.3.2和2.3.3下尝试了成功,没有任何提示吗?

It could be the comment is preventing the '%>' from being parsed 可能是注释阻止了'%>'的解析

Try putting the comment on its own line 尝试将评论放在自己的行上


<%  end 
    #content_for 
%>

I got same issue with <% cache(...) do %> some cached html <% end # some comment %> block and putting comment on its own line didn't work for me. 我在<% cache(...) do %>遇到了同样的问题,一些缓存的html <% end # some comment %>块,将注释放在自己的行上对我不起作用。 I had to do : <% cache do(...) %> some cached html % end %><% some comment %> 我必须做: <% cache do(...) %>一些缓存的html % end %><% some comment %>

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

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