I have some code to allow pages to define sub menus within their respective html files. Here's the method I have in the application helper:
def sub_menu(&block) links ||= links << capture(&block) @sub_menu ||= ""
links.each do |link| @sub_menu += content_tag(:li, link) end
@sub_menu = content_tag(:ul, @sub_menu, :class => "side_menu") @sub_menu = content_tag(:div, @sub_menu, :class => "side_menu_wrapper")
# concat @sub_menu end
In an html file, I can define sub menus like this:
<% content_for :sub_menu do %> <% sub_menu do %> <a href="<%= new_story_path %>" class="side_button"><img src="/ images/new_story_button.png" class="centered" alt="New story!" /></a> <% end %> <% end %>
This worked in Rails 2, but in Rails 3 it just displays the HTML instead of parsing it, and when I look in the source the HTML is cleaned. Here's an example:
<li> <a href="/stories/new" class="side_button"><img src="/images/ new_story_button.png" class="centered" alt="New story!" /></a> </li>
How do I get around this?