Created
March 31, 2015 02:27
-
-
Save satomixx/ec43779cfc881fb84e92 to your computer and use it in GitHub Desktop.
[Rails 4.x] bulk insertをupdateでもしたいときにはupdate_allがあります ref: http://qiita.com/tsumekoara/items/cf8cf3bbf296ecb8d2c7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'activerecord-import' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# openがfalseのレコードをすべてtrueに変更したい | |
Shop.where(open: false).update_all(open: true) | |
# 全部のレコードをopen: trueに | |
Shop.update_all open: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment