Sha256: 803171664475c8a5f7efae6206379e2b24ca78a7a83c76fde7e7b02ec6e9c8ad

Contents?: true

Size: 605 Bytes

Versions: 9

Compression:

Stored size: 605 Bytes

Contents

class CreateDefaultPartTypes < ActiveRecord::Migration
  def self.defaults
    [
      {:name => "One-line", :field_type => "text_field", :field_class => "text"},
      {:name => "Plain textarea", :field_type => "text_area", :field_class => "textarea"},
      {:name => "Boolean", :field_type => "check_box"},
      {:name => "Predefined", :field_type => "predefined"}
    ]
  end

  def self.up
    self.defaults.each do |a|
      PartType.create(a)
    end
  end

  def self.down
    self.defaults.each do |a|
      pt = PartType.find_by_name(a[:name])
      pt.destroy unless pt.nil?
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
radiant-templates-extension-1.0.8 db/migrate/009_create_default_part_types.rb
radiant-templates-extension-1.0.7 db/migrate/009_create_default_part_types.rb
radiant-templates-extension-1.0.6 db/migrate/009_create_default_part_types.rb
radiant-templates-extension-1.0.5 db/migrate/009_create_default_part_types.rb
radiant-templates-extension-1.0.4 db/migrate/009_create_default_part_types.rb
radiant-templates-extension-1.0.3 db/migrate/009_create_default_part_types.rb
radiant-templates-extension-1.0.2 db/migrate/009_create_default_part_types.rb
radiant-templates-extension-1.0.1 db/migrate/009_create_default_part_types.rb
radiant-templates-extension-1.0.0 db/migrate/009_create_default_part_types.rb