diff options
-rw-r--r-- | db/migrate/20180107152351_replace_title_with_date_bands_venue.refinery_gallery_links.rb | 12 | ||||
-rw-r--r-- | vendor/extensions/gallery_links/db/migrate/2_replace_title_with_date_bands_venue.rb | 12 |
2 files changed, 18 insertions, 6 deletions
diff --git a/db/migrate/20180107152351_replace_title_with_date_bands_venue.refinery_gallery_links.rb b/db/migrate/20180107152351_replace_title_with_date_bands_venue.refinery_gallery_links.rb index 86e9dd8..2f79338 100644 --- a/db/migrate/20180107152351_replace_title_with_date_bands_venue.refinery_gallery_links.rb +++ b/db/migrate/20180107152351_replace_title_with_date_bands_venue.refinery_gallery_links.rb @@ -7,9 +7,15 @@ class ReplaceTitleWithDateBandsVenue < ActiveRecord::Migration Refinery::GalleryLinks::GalleryLink.all.each do |g| m = g.title.match /^(.+) (\d{2}\/\d{2}\/\d{2}) @ ([^.]+).$/ - g.date = Date.strptime(m[2], '%d/%m/%y') - g.bands = m[1] - g.venue = m[3] + if m + g.date = Date.strptime(m[2], '%d/%m/%y') + g.bands = m[1] + g.venue = m[3] + else + g.date = Date.today + g.bands = g.title + g.venue = nil + end g.save! end diff --git a/vendor/extensions/gallery_links/db/migrate/2_replace_title_with_date_bands_venue.rb b/vendor/extensions/gallery_links/db/migrate/2_replace_title_with_date_bands_venue.rb index 01bb932..87492b6 100644 --- a/vendor/extensions/gallery_links/db/migrate/2_replace_title_with_date_bands_venue.rb +++ b/vendor/extensions/gallery_links/db/migrate/2_replace_title_with_date_bands_venue.rb @@ -6,9 +6,15 @@ class ReplaceTitleWithDateBandsVenue < ActiveRecord::Migration Refinery::GalleryLinks::GalleryLink.all.each do |g| m = g.title.match /^(.+) (\d{2}\/\d{2}\/\d{2}) @ ([^.]+).$/ - g.date = Date.strptime(m[2], '%d/%m/%y') - g.bands = m[1] - g.venue = m[3] + if m + g.date = Date.strptime(m[2], '%d/%m/%y') + g.bands = m[1] + g.venue = m[3] + else + g.date = Date.today + g.bands = g.title + g.venue = nil + end g.save! end |