searchlogic
searchlogic copied to clipboard
rails 3 and rails_xss html safe
Hi guys, last week i found out a bug in Helpers with new rails 3 or rails_xss html escape.
This piece of code:
if ascending
options[:as] = "▲ #{options[:as]}"
css_classes << "ascending"
else
options[:as] = "▼ #{options[:as]}"
css_classes << "descending"
end
aren't working because "▼ " in the code.
So in my code i did this way:
if ascending
options[:as] = Rails.version >= "2.3.6" ? "▲ #{options[:as]}".html_safe : "▲ #{options[:as]}"
css_classes << "ascending"
else
options[:as] = Rails.version >= "2.3.6" ? "▼ #{options[:as]}".html_safe : "▼ #{options[:as]}"
css_classes << "descending"
end
This fix my problem in all my rails app 2.3.x and i don't if this is the best idea or if work in 2.2.x.
It's just an idea for you think.