Skip to content

Instantly share code, notes, and snippets.

@jfriedlaender
Created August 2, 2011 13:26
Show Gist options
  • Save jfriedlaender/1120174 to your computer and use it in GitHub Desktop.
Save jfriedlaender/1120174 to your computer and use it in GitHub Desktop.
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