Class: RedirectPageModelMigration

Inherits:
Migration
  • Object
show all
Defined in:
lib/yodel/models/migrations/13_redirect_page_model.rb

Class Method Summary collapse

Methods inherited from Migration

copy_missing_migrations_for_all_sites, copy_missing_migrations_for_site, inherited, run_migrations, run_migrations_for_all_sites

Class Method Details

.down(site) ⇒ Object



10
11
12
# File 'lib/yodel/models/migrations/13_redirect_page_model.rb', line 10

def self.down(site)
  site.redirect_pages.destroy
end

.up(site) ⇒ Object



2
3
4
5
6
7
8
# File 'lib/yodel/models/migrations/13_redirect_page_model.rb', line 2

def self.up(site)
  site.pages.create_model :redirect_page do |redirect_pages|
    add_field :url, :string, searchable: false
    add_one   :page, show_blank: true, blank_text: 'None'
    redirect_pages.record_class_name = 'RedirectPage'
  end
end