Sha256: 3a429c2ca46aedc92f752eb98ccc6dd054498722716b403e881122789cfaa43d

Contents?: true

Size: 769 Bytes

Versions: 5

Compression:

Stored size: 769 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"

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

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

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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
decidim-verifications-0.18.1 app/models/decidim/verifications/csv_datum.rb
decidim-verifications-0.17.2 app/models/decidim/verifications/csv_datum.rb
decidim-verifications-0.18.0 app/models/decidim/verifications/csv_datum.rb
decidim-verifications-0.17.1 app/models/decidim/verifications/csv_datum.rb
decidim-verifications-0.17.0 app/models/decidim/verifications/csv_datum.rb