Sha256: 2d811b038d71b58d1a4338814d6f27289f86b6e082c4362342af87748c968f6d

Contents?: true

Size: 862 Bytes

Versions: 112

Compression:

Stored size: 862 Bytes

Contents

def puts! a, b=""
  puts "+++ +++ #{b}"
  puts a.inspect
end

task :migrate => [ 'migrate:assign_galleries_to_profile' ]

namespace :migrate do

  desc 'assign galleries to profile'
  task :assign_galleries_to_profile => :environment do
    u = User.find_by :email => 'piousbox@gmail.com'
    Gallery.unscoped.where( :user_profile => nil ).update_all( :user_profile_id => u.profile.id )
    puts 'Each gallery is associated with a user profile.'
  end

  desc 'destination for every marker'
  task :markers_destinations => :environment do
    ms = Marker.where( destination: nil )
    ms.each do |m|
      d = Map.where( slug: m.slug ).first
      if d
        m.destination = d
        m.save
        puts "Marker |#{m.name}| got destination |#{m.slug}|."
      else
        puts "+++ +++ #{m.slug}, No destination for this one."
      end
    end
  end

end

Version data entries

112 entries across 112 versions & 1 rubygems

Version Path
ish_manager-0.1.8.321 lib/tasks/done/migrate.rake
ish_manager-0.1.8.320 lib/tasks/migrate.rake
ish_manager-0.1.8.318 lib/tasks/migrate.rake
ish_manager-0.1.8.317 lib/tasks/migrate.rake
ish_manager-0.1.8.316 lib/tasks/migrate.rake
ish_manager-0.1.8.315 lib/tasks/migrate.rake
ish_manager-0.1.8.314 lib/tasks/migrate.rake
ish_manager-0.1.8.313 lib/tasks/migrate.rake
ish_manager-0.1.8.312 lib/tasks/migrate.rake
ish_manager-0.1.8.311 lib/tasks/migrate.rake
ish_manager-0.1.8.310 lib/tasks/migrate.rake
ish_manager-0.1.8.309 lib/tasks/migrate.rake
ish_manager-0.1.8.308 lib/tasks/migrate.rake
ish_manager-0.1.8.307 lib/tasks/migrate.rake
ish_manager-0.1.8.306 lib/tasks/migrate.rake
ish_manager-0.1.8.305 lib/tasks/migrate.rake
ish_manager-0.1.8.304 lib/tasks/migrate.rake
ish_manager-0.1.8.303 lib/tasks/migrate.rake
ish_manager-0.1.8.302 lib/tasks/migrate.rake
ish_manager-0.1.8.301 lib/tasks/migrate.rake