Sha256: 083de186835a38e0e4d909b3351e8281d31cc16b9554f054c9f0fa76b13f8599

Contents?: true

Size: 398 Bytes

Versions: 1

Compression:

Stored size: 398 Bytes

Contents

# encoding: utf-8

class AssociarImpressosToPacientes < ActiveRecord::Migration
  def up
    Impresso.all.each do |impresso|
      consulta = Consulta.where(:id => impresso.consulta_id).first
      if consulta.nil?
        impresso.delete
      else
        impresso.update_attribute(:paciente_id, consulta.paciente.id)
      end
    end
  end

  def down
    puts "Impossível realizar"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
omniauth-sabia-1.0.1 db/migrate/20160430200534_associar_impressos_to_pacientes.rb