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