From f0a47be8e73f0674b07c3d09f83e643f837cc96c Mon Sep 17 00:00:00 2001 From: "fabricio.albarnaz" Date: Tue, 9 Oct 2018 11:11:48 -0300 Subject: [PATCH] Change each for find_each in migration --- db/migrate/20181008201815_update_instagram_data.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/db/migrate/20181008201815_update_instagram_data.rb b/db/migrate/20181008201815_update_instagram_data.rb index b4e343f2d73a..eeb4d694a0fb 100644 --- a/db/migrate/20181008201815_update_instagram_data.rb +++ b/db/migrate/20181008201815_update_instagram_data.rb @@ -1,7 +1,6 @@ class UpdateInstagramData < ActiveRecord::Migration def change - enterprises = Enterprise.where("instagram like ?", "%instagram.com%") - enterprises.each do |e| + Enterprise.where("instagram like ?", "%instagram.com%").find_each do |e| e.instagram = "@#{e.instagram.split('/').last}" e.save end