Class: Pairer::Group
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Pairer::Group
- Defined in:
- app/models/pairer/group.rb
Instance Method Summary collapse
Methods inherited from ApplicationRecord
Instance Method Details
#person_ids=(val) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/models/pairer/group.rb', line 8 def person_ids=(val) if val.is_a?(Array) sanitized_array = val.map{|x| x.presence&.strip }.uniq(&:downcase).compact if !new_record? sanitized_array = sanitized_array.intersection(board.people.map(&:public_id)) ### This may slow the query down end self[:person_ids] = sanitized_array.join(";;") else raise "invalid behaviour" end end |
#person_ids_array ⇒ Object
22 23 24 |
# File 'app/models/pairer/group.rb', line 22 def person_ids_array self[:person_ids]&.split(";;") || [] end |
#roles=(val) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/models/pairer/group.rb', line 26 def roles=(val) if val.is_a?(Array) sanitized_array = val.map{|x| x.presence&.strip }.uniq(&:downcase).compact if !new_record? sanitized_array = sanitized_array.intersection(board.roles_array) ### This may slow the query down end self[:roles] = sanitized_array.join(";;") else raise "invalid behaviour" end end |
#roles_array ⇒ Object
40 41 42 |
# File 'app/models/pairer/group.rb', line 40 def roles_array self[:roles]&.split(";;") || [] end |