FortAwesome / font-awesome-sass

Font-Awesome Sass gem for use in Ruby/Rails projects
MIT License
906 stars 265 forks source link

HTML Classes: Rails Array convention #163

Open Raighar opened 5 years ago

Raighar commented 5 years ago

Many default Rails helpers allow to provide the HTML classes as either an Array or a String f.e. link_to("something", some_path, class: ["class_a", "class_b", "class_c"] However, the helper method "icon" requires a String. Otherwise, the given Array is turned into a String using the to_s method, which is counterintuitive to how the rest of the helpers work.

Line 9 in /lib/font_awesome/sass/rails/helpers.rb: content_class << " #{html_options[:class]}" if html_options.key?(:class)

A simple fix would be the following: content_class << " #{Array(html_options[:class]).join(" ")}" if html_options.key?(:class)

Is something like that possible for the next release?