title: How to insert all the nested attributes in bulk using rails active record
body: <p>I have a report model like this :- </p>
  
  <pre><code>class Report &lt; ActiveRecord::Base
    has_many :report_clients
    accepts_nested_attributes_for :report_clients, :reject_if =&gt; proc { |attributes| attributes['client_id'].blank? },  :allow_destroy =&gt; true
  end
  </code></pre>
  
  <p>And report client model is like </p>
  
  <pre><code>class ReportClient &lt; ActiveRecord::Base
    belongs_to :report
  end
  </code></pre>
  
  <p>In the time of report creation my parameter structure will be like </p>
  
  <pre><code>Report.create({name: params[:name],  report_clients_attributes: [{client_id: 1}, {client_id:2}]})
  </code></pre>
  
  <p>It will run 1 query to insert report and 2 queries to insert report_clients.</p>
  
  <p>Generally I used to insert 1000 report_clients against each report which leads to 1000 sql queries.</p>
  
  <p>I know, I can solve the problem using bulk insert by writing raw sql insert. But wanted to know if, is there any other way / better way of doing this. </p>