Class: QueuePageModelMigration

Inherits:
Migration
  • Object
show all
Defined in:
lib/migrations/01_queue_page_model.rb

Class Method Summary collapse

Class Method Details

.down(site) ⇒ Object



19
20
21
# File 'lib/migrations/01_queue_page_model.rb', line 19

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

.up(site) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/migrations/01_queue_page_model.rb', line 2

def self.up(site)
  site.pages.create_model :queue_pages do |queue_pages|
    queue_pages.record_class_name = 'QueuePage'
    queue_pages.allowed_children = []
    queue_pages.allowed_parents = []
    queue_pages.hide_in_admin = true
  end
  
  # default queue page
  home_page = site.pages.where(path: '/').first
  qp = site.queue_pages.new
  qp.show_in_menus = false
  qp.parent = home_page
  qp.title = "Queue"
  qp.save
end