Class: ArticleModelMigration
- Inherits:
-
Migration
- Object
- Migration
- ArticleModelMigration
- Defined in:
- lib/migrations/02_article_model.rb
Class Method Summary collapse
Class Method Details
.down(site) ⇒ Object
17 18 19 |
# File 'lib/migrations/02_article_model.rb', line 17 def self.down(site) site.articles.destroy end |
.up(site) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/migrations/02_article_model.rb', line 2 def self.up(site) site.pages.create_model :articles do |articles| add_field :published, :time add_field :tags, :tags add_field :blog, :alias, of: :parent add_field :search_title, :function, fn: 'format("News: {{title}}")', display: false add_one :author, model: :user articles.allowed_parents = [site.blogs] end site.blogs.modify do |blogs| blogs.allowed_children = [site.articles] end end |