title: How to create a form for a has_many through relationship?
body: <p>In my app i have an index page of books from a Books Model. Think of it as a library. </p>
  
  <p>Now i have Boards that consist of lists. Lets say i have a board called Categories.</p>
  
  <p>So i go to the Categories Board. In my url it is www.example.com/board/1</p>
  
  <p>On this categories board there are many lists. Lets say i have a list called programming books. </p>
  
  <p>So now i need to add books to this list called Programming Books.</p>
  
  <p>I have everything setup i just don't know how to add the books to the list. When i click the add books how do i get that list_id? I want to be able to click add books then it goes to a page that lists all the books. I then want to select the books by checking each one then add them to the list.</p>
  
  <p>Don't worry about the creating the lists or boards i have that setup correctly i am just trying to add books to a list. </p>
  
  <p><strong>Categories Board (www.example.com/board/1)</strong></p>
  
  <pre><code>===================     ===================     
  =Programming Books=     =Adventure Books  =
  ===================     ===================
  = Book 1          =     = add books       =
  = Book 2          =     =                 =
  = Book 3          =     =                 =
  = add books       =     =                 =
  ===================     ===================
  </code></pre>
  
  <p><strong>List Model</strong></p>
  
  <pre><code>belongs_to :user, inverse_of: :list
  
  has_many :list_books
  has_many :books, through: :list_books
  
  accepts_nested_attributes_for :list_books, :allow_destroy =&gt; true
  </code></pre>
  
  <p><strong>List_Books Model</strong></p>
  
  <pre><code>belongs_to :list
  belongs_to :books
  </code></pre>
  
  <p><strong>Book Model</strong></p>
  
  <pre><code>belongs_to :user, inverse_of: :books
  
  has_many :list_books
  has_many :lists, through: :list_books
  
  accepts_nested_attributes_for :list_books, :allow_destroy =&gt; true
  </code></pre>
  
  <p><strong>List Controller</strong></p>
  
  <pre><code>def addbooks
    // Not sure what to put here? It needs to grab the list_id from the list where i clicked add books.
  end
  
  private
    def_params
      // Not sure what params i need
    end
  </code></pre>
  
  <p><strong>AddBooks View</strong></p>
  
  <pre><code>// i need of list of all the books here. Then i want to check each book i want and then submit.
  </code></pre>