title: rails 4 has_many :through not saving associations
body: <p>I have 2 models with many to many association as follows:</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
      has_many :remark_users, :dependent =&gt; :destroy
      has_many :designated_remarks, :through =&gt; :remark_users, :source =&gt; :remark
  end
  
  class Remark &lt; ActiveRecord::Base
       has_many :remark_users, :dependent =&gt; :destroy
      has_many :users, :through =&gt; :remark_users
  
      accepts_nested_attributes_for :users
  end
  </code></pre>
  
  <p>And the relationship:</p>
  
  <pre><code>class RemarkUser &lt; ActiveRecord::Base
      belongs_to :remark
      belongs_to :user
  end
  </code></pre>
  
  <p>The remarks_controller action that should do the save:</p>
  
  <pre><code># PATCH Save users
  def save_users
      @remark = Remark.find(params[:id])
      @remark.users.build(params[:remark_user_ids])
      @remark.save
  end
  </code></pre>
  
  <p>And the form:</p>
  
  <pre><code>&lt;%= form_for @remark, :url =&gt; salveaza_responsabili_remark_path(@remark) do |f| %&gt;
      &lt;% @users.each do |user| %&gt;
          &lt;%= check_box_tag 'remark[remark_user_ids][]', user.id, @remark.users.include?(user) %&gt;
          &lt;%= user.name %&gt;
      &lt;% end %&gt;
      &lt;%= hidden_field_tag 'remark[remark_user_ids][]', '' %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>Te remarks_controller:</p>
  
  <pre><code>params.require(:remark).permit(:description, :suggestion, :origin_details,  process_type_id, :origin_id, :remark_user_ids)
  </code></pre>
  
  <p>Both the User and the Remark already exists, I need a form just for creating the associations, preferably using check boxes.</p>
  
  <p>In Console, the association is saved. But I spend last day trying to make it work in the browser. I have read all what I could find on this matter, and I am very confused right now.</p>
  
  <p>Can someone point me on what the actual form would have to look like, and if there is need to add anything else in the controller?</p>