Sha256: 0993e66d7aa971d1af871fe3639867daa8dd9b42ed4ce55dd3c95241525ea823

Contents?: true

Size: 331 Bytes

Versions: 7

Compression:

Stored size: 331 Bytes

Contents

class UpdateSlugAndTitleInRefineryPageParts < ActiveRecord::Migration
  def change
    begin
      ::Refinery::PagePart.all.each do |pp|
        pp.title ||= pp.slug
        pp.slug = pp.slug.downcase.gsub(" ", "_")
        pp.save!
      end
    rescue NameError
      warn "Refinery::PagePart was not defined!"
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
refinerycms-pages-3.0.6 db/migrate/20150720155305_update_slug_and_title_in_refinery_page_parts.rb
refinerycms-pages-3.0.5 db/migrate/20150720155305_update_slug_and_title_in_refinery_page_parts.rb
refinerycms-pages-3.0.4 db/migrate/20150720155305_update_slug_and_title_in_refinery_page_parts.rb
refinerycms-pages-3.0.3 db/migrate/20150720155305_update_slug_and_title_in_refinery_page_parts.rb
refinerycms-pages-3.0.2 db/migrate/20150720155305_update_slug_and_title_in_refinery_page_parts.rb
refinerycms-pages-3.0.1 db/migrate/20150720155305_update_slug_and_title_in_refinery_page_parts.rb
refinerycms-pages-3.0.0 db/migrate/20150720155305_update_slug_and_title_in_refinery_page_parts.rb