views:

210

answers:

2

Hi,

the following code does work under my Windows development environment, but not on my production Linux/Apache2/FastCGI env.

in my view rhtml file :

<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 :

             <%  end #content_for %>

I tried under Rails 2.3.2 and 2.3.3 without success... any hints?

A: 

It could be the comment is preventing the '%>' from being parsed

Try putting the comment on its own line


<%  end 
    #content_for 
%>
The Who
Yes it works, I also believes this is the cause, however, I don't want to change all my code comments to work on my Linux stack :-S... I don't understand why it doesn't work.
Not sure why you're getting the error (nothing worse than an error that's inconsistent across environments) but on aside - mixing comments in <% tags is probably not a good idea in the first place. You have special comment tags for erb so you should use them if possible. It'll make your code more cohesive and easier to read.
gcahill
A: 

Hi, 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. I had to do : <% cache do(...) %> some cached html <% end %><% some comment %>

Cecile