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

On Dec 21, 12:50 pm, Mike C <snib...@gmail.com> wrote:
> 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?

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to