Class: BlogModelMigration

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

Class Method Summary collapse

Class Method Details

.down(site) ⇒ Object



10
11
12
# File 'lib/migrations/01_blog_model.rb', line 10

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

.up(site) ⇒ Object



2
3
4
5
6
7
8
# File 'lib/migrations/01_blog_model.rb', line 2

def self.up(site)
  site.pages.create_model :blogs do |blogs|
    add_field :articles_per_page, :integer, default: 5
    add_field :blog, :self
    blogs.record_class_name = 'Blog'
  end
end