title: HABTM associantion: Unpermitted parameters
body: <p>What's up folks!</p>
  
  <p>I've been trying to implement an association has_and_belongs_to_many in my rails (4) application. Here is my code:</p>
  
  <p><strong>My Category model</strong></p>
  
  <pre><code>class Admin::Category
      include Mongoid::Document
      ...
      has_and_belongs_to_many :estimates, class_name: "User::Estimate", :inverse_of =&gt; :categories
  end
  </code></pre>
  
  <p><strong>My Estimate model</strong></p>
  
  <pre><code>class User::Estimate
      include Mongoid::Document
      ...
      has_and_belongs_to_many :categories, class_name: "Admin::Category", :inverse_of =&gt; :estimates
  end
  </code></pre>
  
  <p><strong>Strong parameters</strong></p>
  
  <pre><code>def user_estimate_params
      params.require(:user_estimate).permit({:category_ids =&gt; []}, :favorite_time, :city_id, :number_of_guests, :event_date, :stage_where_it_is, :event_type, :observation, user_attributes:[:name, :email, :receive_news, :password, :password_confirmation, :preferred_phone, :alternate_phone])
  end
  </code></pre>
  
  <p><strong>My request</strong></p>
  
  <pre><code>Parameters: {"utf8"=&gt;"✓", "authenticity_token"=&gt;"JJk6m+5VV7tCLDeUCRkQatQOw/fFiw8LCV39casua+c=", "user_estimate"=&gt;{"user_attributes"=&gt;{"email"=&gt;"user@email.com"}, "city_id"=&gt;"523b638b5383de1887000001", "event_type"=&gt;"Casamento", "number_of_guests"=&gt;"456", "event_date"=&gt;"21/11/2013", "stage_where_it_is"=&gt;"Nos próximos 30 dias", "category_ids"=&gt;["523b667687924d211527530e", "523b667b87924d2115275317"], "observation"=&gt;""}, "event_type_select"=&gt;"527ace4353455263c9000000", "commit.x"=&gt;"149", "commit.y"=&gt;"40"}
  Unpermitted parameters: category_ids
  </code></pre>
  
  <p>As you can see I'm getting the error <strong>Unpermitted parameters: category_ids</strong>, which is making me unable to save my categories, even that the categories have already been added to strong parameters method.</p>
  
  <p>I'm using MongoDB/Mongoid.</p>
  
  <p>I've found a lot of similar questions, but these questions have been solved adding the 
      => []</p>
  
  <p>To the strong parameters method, as I've already done.</p>
  
  <p>Any help?</p>
  
  <p>cheers</p>