diff options
Diffstat (limited to 'vendor')
-rw-r--r-- | vendor/extensions/gallery_links/db/migrate/2_replace_title_with_date_bands_venue.rb | 12 |
1 files changed, 9 insertions, 3 deletions
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 |