Module: Populator::Adapters::Postgresql
- Included in:
- ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
- Defined in:
- lib/populator/adapters/postgresql.rb
Instance Method Summary collapse
Instance Method Details
#populate(table, columns, rows, name = nil) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/populator/adapters/postgresql.rb', line 4 def populate(table, columns, rows, name = nil) queries = [] rows.each do |row| row.gsub!(/^\(\d{1,}/, "(DEFAULT") queries << "INSERT INTO #{table} #{columns} VALUES #{row}" end execute(queries.join("; "), name) end |