Orbit/lib/tasks/gallery.rake

23 lines
639 B
Ruby
Raw Normal View History

namespace :gallery do
task :migrate_albums => :environment do
@albums = GalleryAlbum.all
@albums.each do |album|
newalbum = Album.new
newalbum.name = album.name
newalbum.description = album.description
newalbum.cover = album.cover
newalbum.cover_path = album.cover_path
newalbum.tag_names = album.tag_names
newalbum.category_id = album.category_id
newalbum.save!
@images = album.gallery_images
@images.each do |image|
img = newalbum.album_images.new
img.title = image.title
img.description = image.description
img.file = image.file
img.save!
end
end
end
end