Reputation: 374
I've been trying for hours to get my rails form to work but I can't. The error that it keeps throwing says:
ArgumentError at / wrong number of arguments (3 for 1..2)
and the line of code where it says this error occurs is at the f.input line. Any ideas?
.select-width
= f.label :country
= f.input :country, :select, :as => :fancy_select, collection: ['South Africa', 'Nigeria', 'Zimbabwe', 'Mali', 'Namibia'], hint: 'Lorem ipsum hint'
Upvotes: 2
Views: 51
Reputation: 1311
In simple_form
, input
requires only two parameters.
So, you can use following code. It will work fine.
.select-width
= f.label :country
= f.input :country, as: :fancy_select, collection: ['South Africa', 'Nigeria', 'Zimbabwe', 'Mali', 'Namibia'], hint: 'Lorem ipsum hint'
Upvotes: 1
Reputation: 5905
I assume you're using simple_form
:
I guess it will work:
= f.input :country, collection: ['South Africa', 'Nigeria', 'Zimbabwe', 'Mali', 'Namibia'], as: :fancy_select
You can check the documentation how they define select
tag.
Upvotes: 1