Created
December 23, 2014 18:32
-
-
Save acesuares/953f797a785e874a51ba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Cast is the old database, Client is the new... | |
Cast.all.each do |cast| | |
Client.create( | |
{ id: cast.id, | |
family_id: cast.family_id, | |
family_member_id: cast.member_id, | |
first_name: cast.voornaam, | |
last_name: cast.achternaam, | |
middle_name: cast.tussenvoegsels, | |
gender: cast.geslacht == 'male' ? 1 : cast.geslacht == 'female' ? 2 : 0, | |
born_on: (Date.parse(cast.geboorte_datum) rescue Date.parse('19000101')), | |
hair_color_id: HAIR[cast.kleur_haar] || 8, | |
eye_color_id: EYES[cast.kleur_ogen] || 4, | |
length: cast.lengte.to_f < 3 ? (cast.lengte.to_f*100).to_i : cast.lengte.to_i, | |
wup: (cast.maat_wup.gsub(/[0-9]/,'').to_s.upcase rescue ''), | |
first_date: ((Date.parse(cast.datum_first) rescue Date.parse(cast.registration_date)) rescue Date.parse('19000101')), | |
}, without_protection: true) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment