dimanche 28 juin 2015

Rails Simple Form Country Select

I am trying to make an app with Rails and Simple Form with country_select.

I am getting an error that says:

wrong number of arguments (4 for 0)

I am using the example that i found, for simple form on the country select gem documentation page. I don't understand what's 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" %>

In my view I have:

<%= @project.scope.participant.address %>

Can anyone see what I have done wrong in trying to set this up? The error message indicates the problematic line is:

<%= par.select :participation_country,

I can't count 4 of anything except suggested country codes, although I deleted one of those to try and I get the same error.

Aucun commentaire:

Enregistrer un commentaire