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 22, 2015
1 parent ae20814 commit f09240e
Showing 1 changed file with 6 additions and 6 deletions.
@@ -1,11 +1,11 @@
class UpdateSlugAndTitleInRefineryPageParts < ActiveRecord::Migration
def change
Refinery::PagePart.all.each do |pp|
unless pp.title
pp.title = pp.slug
if defined?(::Refinery::PagePart)
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!
end
end
end
end

0 comments on commit f09240e

Please sign in to comment.