Last active
July 27, 2019 01:50
-
-
Save tochi/b24bb7e010dc3db0609eefa8b6ee4d4d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
posts = post_ids.map.with_index(1) do |post_id, i| | |
post = Post.find(post_id) | |
post.title = "#{i}つめの記事です" | |
post | |
end | |
self.import(posts, on_duplicate_key_update: { conflict_target: %i(id), columns: %i(title)) }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment