In the table about 10,000-20,000 objects. I have about 1000 id entries, which you want to change one value. How to do this correctly? I don't want to use each which will be 1000 times INSERT. I think this is not correct.
P.S. This is a normal variant?
accounts_closes = Account.where(:alfa_flag => false).pluck(:id)
Account.transaction do
accounts_closes.each do |account_id|
Account.connection.execute 'UPDATE accounts SET open = false WHERE id = ' + account_id + ';'
end
end