mirror of
https://ghfast.top/https://github.com/discourse/discourse-cakeday.git
synced 2026-07-16 11:47:40 +08:00
18 lines
426 B
Ruby
18 lines
426 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Jobs
|
|
class FixInvalidDateOfBirth < ::Jobs::Onceoff
|
|
def execute_onceoff(args)
|
|
UserCustomField
|
|
.where(name: "date_of_birth")
|
|
.where("value != ''")
|
|
.find_each do |custom_field|
|
|
begin
|
|
Date.parse(custom_field.value)
|
|
rescue ArgumentError
|
|
custom_field.update!(value: "")
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|