Sha256: df3f9b9477e17996837bd5d602524f8fb5c5b5920b9142a38f062a096021dd4d

Contents?: true

Size: 802 Bytes

Versions: 13

Compression:

Stored size: 802 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Verifications
    class CsvDatum < ApplicationRecord
      belongs_to :organization, foreign_key: :decidim_organization_id,
                                class_name: "Decidim::Organization"

      validates :email, format: { with: ::Devise.email_regexp }

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

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

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

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

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
decidim-verifications-0.29.1 app/models/decidim/verifications/csv_datum.rb
decidim-verifications-0.28.4 app/models/decidim/verifications/csv_datum.rb
decidim-verifications-0.29.0 app/models/decidim/verifications/csv_datum.rb
decidim-verifications-0.28.3 app/models/decidim/verifications/csv_datum.rb
decidim-verifications-0.29.0.rc4 app/models/decidim/verifications/csv_datum.rb
decidim-verifications-0.29.0.rc3 app/models/decidim/verifications/csv_datum.rb
decidim-verifications-0.29.0.rc2 app/models/decidim/verifications/csv_datum.rb
decidim-verifications-0.29.0.rc1 app/models/decidim/verifications/csv_datum.rb
decidim-verifications-0.28.2 app/models/decidim/verifications/csv_datum.rb
decidim-verifications-0.28.1 app/models/decidim/verifications/csv_datum.rb
decidim-verifications-0.28.0 app/models/decidim/verifications/csv_datum.rb
decidim-verifications-0.28.0.rc5 app/models/decidim/verifications/csv_datum.rb
decidim-verifications-0.28.0.rc4 app/models/decidim/verifications/csv_datum.rb