0
<% @feed.each do |feed| %>
<ul id="feed">
<%=
case feed.action_type
when "COMMENT"
<%= render :partial => "feeds/storyitem" -%>,
end
%>
</ul>
<% end %>
<% @feed.each do |feed| %>
<ul id="feed">
<%=
case feed.action_type
when "COMMENT"
<%= render :partial => "feeds/storyitem" -%>,
end
%>
</ul>
<% end %>
你不能像鳥巢ERB標籤 - 你試圖插入render...
ERB標籤,當你已經在ERB內時。如果這是你真正想做的事,試試這個:
<% @feed.each do |feed| %>
<ul id="feed">
<% case feed.action_type
when "COMMENT" %>
<%= render :partial => "feeds/storyitem" -%>,
<% end %>
</ul>
<% end %>
但是,除非你已經簡化了在這裏張貼的代碼示例中,<% if %>
看起來更清晰的給我。
確定想通了:
<% @feed.each do |feed| %>
<ul id="feed">
<%=
case feed.action_type
when "COMMENT"
render :partial => "feeds/storyitem"
end
%>
</ul>
<% end %>
不需要周圍的<%渲染部分