Du kan bruge COPY FROM STDIN til at komme uden om dette... sådan:
conn = ActiveRecord::Base.connection_pool.checkout
raw = conn.raw_connection
raw.exec("COPY tablename (col1, col2, col3) FROM STDIN")
# open up your CSV file looping through line by line and getting the line into a format suitable for pg's COPY...
raw.put_copy_data line
# once all done...
raw.put_copy_end
while res = raw.get_result do; end # very important to do this after a copy
ActiveRecord::Base.connection_pool.checkin(conn)
Jeg tror, der er nogle muligheder for at KOPIERE, som vil lade dig angive, at du sender CSV-data, hvilket ville gøre det endnu nemmere...