Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/CLOSER-Cohorts/archivist
Browse files Browse the repository at this point in the history
…into develop
  • Loading branch information
wpoynter committed May 17, 2017
2 parents a7a9a9e + c45ea3e commit 80c0d30
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion app/models/group.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
# Group representents a set of {User Users} that are interested in particular
# studies
#
# === Properties
# * group_type
# * label
# * study
class Group < ApplicationRecord
# Each Group can have multiple {User Users}
has_many :users

# Study can hold either a String or an Array, but is still stored in a single
# database column
serialize :study

# Before saving clear study value
before_save :remove_study_labelling

private
private # Private methods

# Incase more than just the study label is submitted extract the label for
# saving
def remove_study_labelling
if study.is_a? Array
study.map! do |s|
Expand Down

0 comments on commit 80c0d30

Please sign in to comment.