countries / country_select

Gemification of rails's country_select
https://country-select-demo.onrender.com
MIT License
704 stars 198 forks source link

HTML attributes no longer work after upgrade to 9.0 gem #225

Closed mchilson closed 8 months ago

mchilson commented 8 months ago

Hi,

I upgraded my country_select gem in my rails 7.1 project from 8 to 9 and now this line no longer applies the CSS style class to the dropdown:

<%= f.country_select( :country_code, priority_countries: ["US", "AU", "CA", "UK"], {class: "login-form"}) %>

This throws an error.

ActiveSupport::SyntaxErrorProxy: /home/mike/rails_projects/rcsb-v2/app/views/devise/registrations/edit.html.erb:51: syntax error, unexpected ')', expecting => ..., "UK"], {class: "login-form"}) ); @output_buffer.safe_appen...

Any ideas? I have tried many variations of applying the class to the dropdown but none of them work.

pmor commented 8 months ago

Try <%= f.country_select( :country_code, { priority_countries: ["US", "AU", "CA", "UK"] }, {class: "login-form"}) %>, I believe that should work.

mchilson commented 8 months ago

Thanks pmor. That worked. Sometimes you can't see the forest for the trees. :-)

mchilson commented 8 months ago

Problem solved.