Skip to content

Commit

Permalink
ensure class names exist first in migration
Browse files Browse the repository at this point in the history
  • Loading branch information
bricesanchez committed Jul 23, 2015
1 parent ae20814 commit 327c2f0
Showing 1 changed file with 8 additions and 6 deletions.
@@ -1,11 +1,13 @@
class UpdateSlugAndTitleInRefineryPageParts < ActiveRecord::Migration
def change
Refinery::PagePart.all.each do |pp|
unless pp.title
pp.title = pp.slug
begin
::Refinery::PagePart.all.each do |pp|
pp.title ||= pp.slug
pp.slug = pp.slug.downcase.gsub(" ", "_")
pp.save!
end
pp.slug = pp.slug.downcase.gsub(" ", "_")
pp.save!
rescue NameError
warn "Refinery::PagePart was not defined!"
end
end
end
end

0 comments on commit 327c2f0

Please sign in to comment.