Umi and Satomi

シーズー犬うみと飼い主Satomiが楽しく生活してみます

try update_all as bulk update like bulk insert

to use bulk insert on Rails, add gem below.

gem 'activerecord-import'

In MySQL, bulk update can be used by this gem, but postgres..... sqlite.....

update_all

solution!

# make all records with open: false to open:  true 
Shop.where(open: false).update_all(open: true)

# Update all shops with the given attributes
Shop.update_all open: true

References