Updating to Rails 2.3.11 without using html_safe

Only thing not working as expected is that the h helper did escape html_safe output, but we can fix that easily…

# make h work the same no matter if a string is safe
# ERB::Util.h("
".html_safe).should_not == "
" module ERB::Util def html_escape(s) s.to_s.gsub(/[&"><]/) { |special| HTML_ESCAPE[special] } end alias h html_escape module_function :h module_function :html_escape end

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s