Rails Code:
sql = File.read("#{Rails.root}/scripts/refresh.sql")
db_con = ActiveRecord::Base.connection
db_con.execute(sql)
file refresh.sql:
select 1;
If I create or modify file refresh.sql in pgAdmin (Ubuntu or Windows) I will get the following error:
PG::SyntaxError: ERROR: syntax error at or near "select"
LINE 1: select 1;
However, if I copy and paste the sql text into a text editor (sublime or gedit) and overwrite file refresh.sql the code runs