Class: EgovUtils::ArchiveUsers

Inherits:
Object
  • Object
show all
Defined in:
app/services/egov_utils/archive_users.rb

Instance Method Summary collapse

Instance Method Details

#callObject



3
4
5
6
7
8
9
10
11
# File 'app/services/egov_utils/archive_users.rb', line 3

def call
  EgovUtils::User
    .where.not(days_before_archive: nil, active: true).each do |user|
    date_to_compare = user. || user.created_at
    next if date_to_compare > Time.now - user.days_before_archive.days

    user.destroy
  end
end