I need to open a .txt file that has a sequence of strings separated by ";" and I need to put every ";" in a vector to later create a loop and insert into the bank.
What I have:
require 'pg'
require 'active_record'
= File.open('teste.txt')
f_lines = f.read.split(";")
Connection to the bank
conn = ActiveRecord::Base.establish_connection(:adapter => 'postgresql',
:username => 'root',
:password => "123",
:host => "127.0.0.1",
:database => "db")
#query = "insert into students (name, registration, room, password) values "+ vetor[]
#simulated = ActiveRecord::Base.connection.execute(query)
PS: My .txt file will have multiple lines.