rails 3 cleaning sub menu html

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:

&lt;li&gt; &lt;a href=&quot;/stories/new&quot; class=&quot;side_button&quot;&gt;&lt;img src=&quot;/images/ new_story_button.png&quot; class=&quot;centered&quot; alt=&quot;New story!&quot; /&gt;&lt;/a&gt; &lt;/li&gt;

How do I get around this?

Sounds like you need to call .html_safe on the return value of your helper. In Rails 3, everything is automatically scrubbed.

fyi, you can also pass the content into the raw() function.

Thanks for the replies! I tried both ways and oddly enough they didn't work...