binarylogic / searchlogic

Searchlogic provides object based searching, common named scopes, and other useful tools.
http://rdoc.info/projects/binarylogic/searchlogic
MIT License
1.39k stars 133 forks source link

rails 3 and rails_xss html safe #95

Open kivanio opened 14 years ago

kivanio commented 14 years ago

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] = "&#9660;&nbsp;#{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" ? "&#9650;&nbsp;#{options[:as]}".html_safe : "&#9650;&nbsp;#{options[:as]}"
      css_classes << "ascending"
    else
      options[:as] = Rails.version >= "2.3.6" ? "&#9660;&nbsp;#{options[:as]}".html_safe : "&#9660;&nbsp;#{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.