Sha256: ec76c00455b9a4512378a61e86d41ff2a3b325b65b9d66278994cf0feca6e15d

Contents?: true

Size: 604 Bytes

Versions: 6

Compression:

Stored size: 604 Bytes

Contents

namespace :forgeos do
  namespace :core do
    desc 'copy attachments association table values into an unique table'
    task :attachments_migration => :environment do
      elements = [] <<
      Product.all <<
      User.all <<
      Attribute.all <<
      ProductType.all <<
      Category.all <<
      AttributeValue.all

      elements.flatten.each do |element|
        print "#{element.class} ##{element.id} : "
        element.attachments2 = element.attachments
        if element.save
          puts 'ok'
        else
          puts element.errors.inspect
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
forgeos_core-1.9.5.rc2 lib/tasks/attachments_migration.rake
forgeos_core-1.9.5.rc1 lib/tasks/attachments_migration.rake
forgeos_core-1.9.4 lib/tasks/attachments_migration.rake
forgeos_core-1.9.3 lib/tasks/attachments_migration.rake
forgeos_core-1.9.2 lib/tasks/attachments_migration.rake
forgeos_core-1.9.1 lib/tasks/attachments_migration.rake