title: How to bulk insert with Arel?
body: <p>I have something like the following loop, which creates many inserts:</p>
  
  <pre><code>table = Arel::Table.new(:users)
  users.each do |user|
    manager = Arel::InsertManager.new(ActiveRecord::Base)
    manager.into(table).insert([
      [table[:name], user.name],
      [table[:created_at], user.created_at],
      [table[:updated_at], user.updated_at]
    ])
    # INSERT INTO users (name) VALUES ('a')
    @conn.insert(manager.to_sql)
  end
  </code></pre>
  
  <p>However, I would like to find a way to get only the values to be inserted. In this was I would be able to do a single insert for all values.</p>
  
  <p>PS: please note I don't wan't to write sql strings (security concerns).</p>
  
  <pre><code>table = Arel::Table.new(:users)
  inserts = []
  users.each do |user|
    manager = Arel::InsertManager.new(ActiveRecord::Base)
    manager.into(table).insert([
      [table[:name], user.name],
      [table[:created_at], user.created_at],
      [table[:updated_at], user.updated_at]
    ])
    inserts &lt;&lt; "(#{??manage values??})"
  end
  # INSERT INTO users (name) VALUES ('a'), ('b'), ('c')
  @conn.insert(????)
  </code></pre>