Need to update a field within my mysql db. Would like to use the following query within rails:
update users set exported = TRUE where id = #{name[12]}
Currently, have the following:
db = Mysql2::Client.new( :host => 'localhost', :username => 'username', :password => 'password', :database => 'database')
results = db.query("select * from users where start_date is not NULL AND exported = 0").each(:as => :array)
results.each do |name|
db.query("update users set exported = TRUE where id = #{name[12]}")
end
index 12 is equal to the UID.