Simple_form: Can't use `f.input` with `country_select`

Created on 2 Apr 2014  路  11Comments  路  Source: heartcombo/simple_form

When I use country_select, on input columns of name :country, or :country_code, I get an error: wrong number of arguments (4 for 1..3).

Instead of using f.input, I have to use f.country_select. However, the documentation doesn't specify this.

I am using gem 'country_select', :git => "https://github.com/stefanpenner/country_select.git" -- which is version 2 branch.

Feature request

Most helpful comment

Try something like:

<%= f.input :country_id, as: :country, priority: ['US', 'CA'] %>

We're using country_select 2.1.0 and simple_form 3.1.0.rc2, and this works fine.

All 11 comments

We don't support version 2 branch. Make sure you are using the version 1

OK thanks, hopefully someday...

I'll leave this open to implement later.

@rafaelfranca,

I've tested removing input_priority from PriorityInput (https://github.com/plataformatec/simple_form/blob/master/lib/simple_form/inputs/priority_input.rb#L7) and it works.

Since now it only accepts 3 arguments, do you think it's worth creating a new input for country_select? How would you solve it?

If you give me some guidance I think I can work it out :)

Yes, I think we will need to create a new input for it but we will have to wait country_select 2 be released, and we will have to support both versions.

Ok. I will follow up the version 2 release. Let me know if I can be of any help!

Any progress on this? I'm encountering the same issue. Thanks!

Try something like:

<%= f.input :country_id, as: :country, priority: ['US', 'CA'] %>

We're using country_select 2.1.0 and simple_form 3.1.0.rc2, and this works fine.

Many thanks Edslocomb that is so useful.

It's been while since this issue was open and I don't know if it's an issue yet. By now, I'm gonna close this, but we can reopen if you still are facing it on the last Simple Form version.

Thanks

Was this page helpful?
0 / 5 - 0 ratings