fix metacode asset path update db migration
This commit is contained in:
parent
3aea952e40
commit
0e7690f2af
2 changed files with 12 additions and 9 deletions
|
@ -1,9 +0,0 @@
|
|||
class MetacodeAssetPathUpdate < ActiveRecord::Migration
|
||||
def change
|
||||
Metacode.all.each do |metacode|
|
||||
if metacode.icon.start_with?("/assets/icons/")
|
||||
metacode.update(icon: metacode.icon.gsub(/^\/assets\/icons/, "https://s3.amazonaws.com/metamaps-assets/metacodes"))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
12
db/migrate/20160120061513_metacode_asset_path_update.rb
Normal file
12
db/migrate/20160120061513_metacode_asset_path_update.rb
Normal file
|
@ -0,0 +1,12 @@
|
|||
class MetacodeAssetPathUpdate < ActiveRecord::Migration
|
||||
def change
|
||||
Metacode.first(50).each do |metacode|
|
||||
if metacode.icon.start_with?("/assets/icons/")
|
||||
metacode.icon = metacode.icon.sub(/^\/assets\/icons/, "https://s3.amazonaws.com/metamaps-assets/metacodes")
|
||||
metacode.icon = metacode.icon.sub('blueprint_96px', 'blueprint/96px')
|
||||
metacode.icon = metacode.icon.sub('generics_96px', 'generics/96px')
|
||||
metacode.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue