Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML Classes: Rails Array convention #163

Open
Raighar opened this issue Sep 19, 2018 · 0 comments
Open

HTML Classes: Rails Array convention #163

Raighar opened this issue Sep 19, 2018 · 0 comments

Comments

@Raighar
Copy link

Raighar commented Sep 19, 2018

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant