I'm trying to add CodeRay and RedCloth to a Rails 3 application and am getting some strange behaviors. I followed this RailsCast, but since Rails 3 escapes the HTML by default, my HTML is being escaped a couple of times. What do I need to change?
module ApplicationHelper
def coderay(text)
text.gsub(/\<code( lang="(.+?)")?\>(.+?)\<\/code\>/m) do
content_tag("notextile", CodeRay.scan($3, $2).div(:css => :class))
end
end
end
<%= textilize(coderay(@post.body)) %>