title: Solution for nested form
body: <p>I have been stuck on this problem for a while. </p>
  
  <p>Need to make a form for <em>competitions</em> <strong>category</strong> with custom inputs. It should take all values from <strong>Information</strong> table and build the inputs, but the tricky part is that it should be saved to <strong>Category_informations</strong> table.</p>
  
  <pre><code>class Competition &lt; ApplicationRecord
    has_many :categories
    has_many :informations
  end
  
  class Category &lt; ApplicationRecord
    belongs_to :competetion
    has_many :category_informations
    has_many :information, through: competition
  end
  
  class CategoryInformation
    belongs_to :catagory
    belongs_to :information
  end
  
  class Information &lt; ApplicationRecord
    belongs_to :competetion
    has_many :category_informations
  end
  </code></pre>
  
  <p>Competition -> name</p>
  
  <p>Category -> name, competition_id</p>
  
  <p>Information -> name, competition_id</p>
  
  <p>Category_informations -> value, category_id, information_id</p>