Skip to content

Instantly share code, notes, and snippets.

@petha
Created June 2, 2016 08:53
Show Gist options
  • Save petha/ceb33b7c6c24dd23405e3c19ee6e9b62 to your computer and use it in GitHub Desktop.
Save petha/ceb33b7c6c24dd23405e3c19ee6e9b62 to your computer and use it in GitHub Desktop.
models_to_update = {'Block::Article' => ['body'],
'Block::Calendar' => ['column_1', 'column_2'],
'Block::File' => ['content'],
'Block::SingleColumn' => ['column'],
'Block::TwoColumn' => ['column_1', 'column_2'],
'Notification' => ['details'],
'Performance' => ['description', 'info_column_1', 'info_column_2'],
'Performance::Category' => ['description'],
'Employee::Category' => ['info'],
'Employee' => ['bio'] }
models_to_update.each do |model,fields|
model = model.constantize
model.all.each do |row|
fields.each do |field|
row.send(field).try(:gsub!, 'http://ostgotateatern-production.herokuapp.com', '')
end
if row.changed?
row.save
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment