Sha256: 7f1d28d49b07a119461d3f4126bb45386caa7d9fa78875cc8c901944383605f7

Contents?: true

Size: 669 Bytes

Versions: 13

Compression:

Stored size: 669 Bytes

Contents

class MenuModelMigration < Migration
  def self.up(site)
    site.records.create_model :menu do |menus|
      add_one   :root, model: :page, validations: {required: {}}
      add_field :include_root, :boolean, default: false
      add_field :include_all_children, :boolean, default: true
      add_field :depth, :integer, default: 0, validations: {required: {}}
      add_embed_many :exceptions do
        add_one   :page
        add_field :show, :boolean, default: false
        add_field :depth, :integer, default: 0, validations: {required: {}}
      end
      menus.record_class_name = 'Menu'
    end
  end
  
  def self.down(site)
    site.menus.destroy
  end
end

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
yodel-0.0.7 lib/yodel/models/migrations/14_menu_model.rb
yodel_production_environment-0.0.7 lib/migrations/yodel/14_menu_model.rb
yodel_development_environment-0.0.7 lib/migrations/yodel/14_menu_model.rb
yodel_production_environment-0.0.4 lib/migrations/yodel/14_menu_model.rb
yodel_development_environment-0.0.4 lib/migrations/yodel/14_menu_model.rb
yodel-0.0.4 lib/yodel/models/migrations/14_menu_model.rb
yodel-0.0.3 lib/yodel/models/migrations/14_menu_model.rb
yodel_production_environment-0.0.2 lib/migrations/yodel/14_menu_model.rb
yodel_development_environment-0.0.2 lib/migrations/yodel/14_menu_model.rb
yodel-0.0.2 lib/yodel/models/migrations/14_menu_model.rb
yodel-0.0.1 lib/yodel/models/migrations/14_menu_model.rb
yodel_development_environment-0.0.1 lib/migrations/yodel/14_menu_model.rb
yodel_production_environment-0.0.1 lib/migrations/yodel/14_menu_model.rb