Created
June 2, 2016 08:53
-
-
Save petha/ceb33b7c6c24dd23405e3c19ee6e9b62 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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