Class: Decidim::Elections::Voter
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Decidim::Elections::Voter
- Includes:
- Traceable
- Defined in:
- app/models/decidim/elections/voter.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.bulk_insert(election, values) ⇒ Object
11 12 13 |
# File 'app/models/decidim/elections/voter.rb', line 11 def self.bulk_insert(election, values) values.each { |data| create(election:, data: data.transform_keys(&:to_s)) } end |
Instance Method Details
#identifier ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'app/models/decidim/elections/voter.rb', line 15 def identifier if data.is_a?(Hash) data[:identifier] || data[:email] || data[:phone_number] || data[:name] || data[:username] || data.values.first elsif data.present? data.to_s.truncate(50) else id end end |