title: Simple Form check box for join table relationship
body: <p>I can't figure this out for the life of me but here are my models:</p>
  
  <pre><code>class User &lt; ApplicationRecord
    has_many :user_stores
    has_many :stores, through: :user_stores        
  end
  
  class UserStore &lt; ApplicationRecord
    belongs_to :user
    belongs_to :store
  end
  
  class Store &lt; ApplicationRecord
    has_many :user_stores
    has_many :users, through: :user_stores
  end
  </code></pre>
  
  <p>So I have a join table, I'm trying to make a form, which would have selected checkboxes next to the store names that the user has selected (this information would come from the join table relationship) and open checkboxes for the remaining stores (coming from the Store model). How do I show that in the view/make it work in the controller as well. Would I use collections instead? ( I am using Devise and Simple Form gem )</p>
  
  <p>This is what I have so far:</p>
  
  <pre><code>&lt;h1&gt;Add Favorite Stores&lt;/h1&gt;
  &lt;%= simple_form_for(@user, html: { class: 'form-horizontal' }) do |f| %&gt;
    &lt;%= f.fields_for :stores, @user.stores do |s| %&gt;
      # not sure if this is the right way or not
    &lt;% end %&gt;
    &lt;%= f.button :submit %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>Store Controller:</p>
  
  <pre><code>class StoresController &lt; ApplicationController
  ...
    def new
      @user = current_user
      @stores = Store.all
      # @user.stores =&gt; shows user's stores (from join table)
    end
  end
  </code></pre>