Created
August 2, 2011 13:26
-
-
Save jfriedlaender/1120174 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
desc "Updating birth dates from date of birth" | |
task :update_birth_date_fields => :environment do | |
puts "Updating birth dates from date of birth" | |
User.where('date_of_birth is not null').each do |u| | |
u.birth_month = u.date_of_birth.month | |
u.birth_day = u.date_of_birth.day | |
u.save | |
end | |
puts "Finished updating birth dates from date of birth" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment