Skip to content

Commit

Permalink
Change each for find_each in migration
Browse files Browse the repository at this point in the history
  • Loading branch information
fabricio.albarnaz committed Oct 19, 2018
1 parent 6b93284 commit f0a47be
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions db/migrate/20181008201815_update_instagram_data.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit f0a47be

Please sign in to comment.