title: Multiple HABTM properties with ActiveAdmin and Rails 4: data not saved
body: <p>I have the following models:</p>
  
  <pre><code>class Programme &lt; ActiveRecord::Base
  
    has_and_belongs_to_many :nationalities, class_name: 'Nation', join_table: 'nationalities_nations'
    has_and_belongs_to_many :destinations, class_name: 'Nation', join_table: 'destinations_nations'
  
    accepts_nested_attributes_for :nationalities
    accepts_nested_attributes_for :destinations
  
  end
  </code></pre>
  
  <p>and </p>
  
  <pre><code>class Nation &lt; ActiveRecord::Base
  
    has_and_belongs_to_many :nationality_programmes, class_name: 'Programme', join_table: 'nationalities_nations'
    has_and_belongs_to_many :destination_programmes, class_name: 'Programme', join_table: 'destinations_nations'
  
    accepts_nested_attributes_for :nationality_programmes
    accepts_nested_attributes_for :destination_programmes
  
  end
  </code></pre>
  
  <p>In active admin I have the following configuration which pre-selects any existing stored country references correctly (See screenshot).</p>
  
  <pre><code>ActiveAdmin.register Programme do
  
    permit_params :title,
              destinations_ids: [:id],
              nationalities_ids: [:id]
  
  
    form do |f|
      f.actions
      f.inputs 'Countries / Regions' do
        f.input :nationalities, :as =&gt; :select, :input_html =&gt; {:multiple =&gt; true}
        f.input :destinations, :as =&gt; :select, :input_html =&gt; {:multiple =&gt; true}
        f.input :title
      end
      f.actions
    end
  end
  </code></pre>
  
  <p>However, when I select other countries, the form successfully saves, but the references aren’t stored.</p>
  
  <p>This is my schema:</p>
  
  <pre><code>ActiveRecord::Schema.define(version: 20140522131219) do
  
    create_table "destinations_nations", force: true do |t|
      t.integer "programme_id", null: false
      t.integer "nation_id",    null: false
    end
  
    create_table "levels_programmes", force: true do |t|
      t.integer "programme_id", null: false
      t.integer "level_id",     null: false
    end
  
    create_table "nationalities_nations", force: true do |t|
      t.integer "programme_id", null: false
      t.integer "nation_id",    null: false
    end
  
    create_table "nations", force: true do |t|
      t.string   "slug",       limit: 2
      t.string   "name"
    end
  
    create_table "programmes", force: true do |t|
      t.string   "title"
    end
  
  end
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/xSAVL.png" alt="enter image description here"></p>
  
  <p><strong>Update</strong>: Cross-posted this issue on <a href="https://github.com/gregbell/active_admin/issues/3196" rel="noreferrer">active_admin#3196</a> which is now closed, thanks to Gregorio's help.</p>