Sha256: feab6ccb647532718e4b0d04bbb279faeecd24f0503538e8b024437a1e3d3262
Contents?: true
Size: 865 Bytes
Versions: 19
Compression:
Stored size: 865 Bytes
Contents
class AddAssociationsToPolygalleryPhotos < ActiveRecord::Migration def up add_column :polygallery_photos, :gallery_title, :string add_column :polygallery_photos, :galleryable_id, :integer add_column :polygallery_photos, :galleryable_type, :string if Polygallery::Gallery.any? Polygallery::Gallery.all.each do |pg| if pg.polygallery_photos.any? pg.polygallery_photos.each do |pp| pp.update_attributes :gallery_title => pg.title, :galleryable_id => pg.galleryable_id, :galleryable_type => pg.galleryable_type end end end end end def down remove_column :polygallery_photos, :gallery_title remove_column :polygallery_photos, :galleryable_id remove_column :polygallery_photos, :galleryable_type end end
Version data entries
19 entries across 19 versions & 1 rubygems