Class: Decidim::Verifications::CsvDatum

Inherits:
ApplicationRecord show all
Defined in:
app/models/decidim/verifications/csv_datum.rb

Class Method Summary collapse

Class Method Details

.clear(organization) ⇒ Object



26
27
28
# File 'app/models/decidim/verifications/csv_datum.rb', line 26

def self.clear(organization)
  inside(organization).delete_all
end

.insert_all(organization, values) ⇒ Object



22
23
24
# File 'app/models/decidim/verifications/csv_datum.rb', line 22

def self.insert_all(organization, values)
  values.each { |value| create(email: value, organization:) }
end

.inside(organization) ⇒ Object



11
12
13
# File 'app/models/decidim/verifications/csv_datum.rb', line 11

def self.inside(organization)
  where(organization:)
end

.search_user_email(organization, email) ⇒ Object



15
16
17
18
19
20
# File 'app/models/decidim/verifications/csv_datum.rb', line 15

def self.search_user_email(organization, email)
  inside(organization)
    .where(email:)
    .order(created_at: :desc, id: :desc)
    .first
end