migrate metacodes that started with /assets/icons to use amazonaws urls. Remove last migration I made

This commit is contained in:
Devin Howard 2015-10-28 14:24:52 +08:00 committed by Connor Turland
parent d8da2d93fd
commit d99ed6b627
2 changed files with 10 additions and 8 deletions

View file

@ -1,8 +0,0 @@
class RemoveAssetPathsFromMetacodes < ActiveRecord::Migration
def change
Metacode.all.each do |metacode|
metacode.icon = metacode.icon.gsub(/^\/assets\//, '')
metacode.save
end
end
end

View file

@ -0,0 +1,10 @@
class MetacodeAssetPathUpdate < ActiveRecord::Migration
def change
Metacode.all.each do |metacode|
if metacode.icon.start_with?("/assets/icons/")
metacode.icon = metacode.icon.gsub(/^\/assets\/icons/, "https://s3.amazonaws.com/metamaps-assets/metacodes")
metacode.save
end
end
end
end