I am trying to create an application with Rails and Simple Form with country selection.
I get an error message:
wrong number of arguments (4 for 0)
I am using the example that I found for a simple form on the gem page select page. I do not understand what is going wrong.
In my model, I have:
geocoded_by :address after_validation :geocode, if: ->(obj){ @obj.address.present? and @obj.address_changed? } def address [city, state, participation_country].compact.join(', ') end
In my form, I have:
<%= f.simple_fields_for :scope do |participants_s| %> <%= participants_s.simple_fields_for :participant do |par| %> <%= par.select :participation_country, priority: ["AU", "GB", "NZ", "US"], selected: :participation_country, label: false, prompt: "Select participation country" %>
I get the same error when I use
<%= par.input :participation_country,
In my opinion, I have:
<%= @project.scope.participant.address %>
Can anyone understand what I did wrong trying to fix this? The error message indicates the problem line:
<%= par.select :participation_country,
I cannot count 4 from anything other than the proposed country codes, although I deleted one of them to try and I get the same error.
When I try:
<%= par.country_select("participation_country", {:prompt => "Choose Country"})%>
I get the same error: wrong number of arguments (4 for 0)
I also tried to remove the gem to select the country and set the country_select gem instead. The hint for using a country_select pearl with a simple shape has the following example:
country_select("user", "country", only: ["GB", "FR", "DE"])
However, the sample application for a simple form shows this as:
<fieldset> <legend>With Only Chosen Countries</legend> <%= f.input :country_code, only: ["LV","SG"] %> <code>f.input :country_code, only: ["LV","SG"]</code>
When I try to run an example application, as well as leadership styles, I get errors that methods do not recognize.