Reputation: 149
I'm trying to add country flag using options_for_select method but no success. Can someone help?
I tried a couple of options already(example below), none of them works properly.
options_for_select(ISO3166::Country.all.map { |country| [country.name, country.alpha2, { 'class' => "flag-icon flag-icon-us"}] }.sort_by { |country| country.first }, countries)
Upvotes: 2
Views: 458
Reputation: 11216
Maybe try this instead?
options_for_select(ISO3166::Country.all.map { |country| [country.name, country.alpha2, country.emoji_flag] }.sort_by { |country| country.first }, countries)
Upvotes: 1