Sha256: 9bfc9b25d7a1e5d589dfe885f909086445af170a6b0c7cd7c351158b0f6a3307
Contents?: true
Size: 765 Bytes
Versions: 2
Compression:
Stored size: 765 Bytes
Contents
class MakeContentImagePolymorph < ActiveRecord::Migration def self.up add_column :content_images, :content_part_as_overlay_type, :string add_column :content_images, :content_part_type, :string # also convert exisiting data to the new scheme ContentImage.all.each do |image| if !image.content_part_id.blank? image.content_part = ContentPart.find(image.content_part_id) end if !image.content_part_as_overlay_id.blank? cp = ContentPart.find(image.content_part_as_overlay_id) cp.image_overlay = image cp.save! end image.save! end end def self.down remove_column :content_parts, :content_part_as_overlay_type remove_column :content_parts, :content_part_type end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
spree-cms-0.2.1 | db/migrate/0009_make_content_image_polymorph.rb |
spree-cms-0.2.0 | db/migrate/0009_make_content_image_polymorph.rb |