Sha256: 6af0a813a0d8b358d2725f92bb232d57aa69ffa0e8425236b6381dddd0e33ffd

Contents?: true

Size: 452 Bytes

Versions: 7

Compression:

Stored size: 452 Bytes

Contents

class AddCustomSlugToRefineryPages < ActiveRecord::Migration
  def up
    if page_column_names.exclude?('custom_slug')
      add_column :refinery_pages, :custom_slug, :string
    end
  end

  def down
    if page_column_names.include?('custom_slug')
      remove_column :refinery_pages, :custom_slug
    end
  end

  private
  def page_column_names
    return [] unless defined?(::Refinery::Page)

    Refinery::Page.column_names.map(&:to_s)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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