Task: parse individual_date
This commit is contained in:
parent
8828663880
commit
6370365fe4
1 changed files with 14 additions and 0 deletions
14
lib/tasks/2018_04_03_type_individual_date.rake
Normal file
14
lib/tasks/2018_04_03_type_individual_date.rake
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
namespace :'2018_04_03_type_individual_date' do
|
||||||
|
task set: :environment do
|
||||||
|
Individual.all.each { |individual| save_birthdate_in_datetime_format(individual) }
|
||||||
|
end
|
||||||
|
|
||||||
|
def save_birthdate_in_datetime_format(individual)
|
||||||
|
if individual.birthdate.present?
|
||||||
|
begin
|
||||||
|
individual.update_column(:second_birthdate, Date.parse(individual.birthdate))
|
||||||
|
rescue
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue