Skip to content

Commit

Permalink
Remove group_type based on group class because we handle STI separa…
Browse files Browse the repository at this point in the history
…tely
  • Loading branch information
joelvh committed May 10, 2017
1 parent 87fc7ec commit aa8411c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/groupify/adapter/active_record/group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def merge!(source_group, destination_group)
end

source_group.transaction do
source_group.group_memberships_as_group.update_all(group_id: destination_group.id, group_type: destination_group.class.model_name.to_s)
source_group.group_memberships_as_group.update_all(group_id: destination_group.id)
source_group.destroy
end
end
Expand Down Expand Up @@ -149,7 +149,7 @@ def <<(*args)
to_add_directly << member unless include?(member)
# add a second entry for the given membership type
if membership_type
membership = member.group_memberships_as_member.where(group_id: group.id, group_type: group.class.model_name.to_s, membership_type: membership_type).first_or_initialize
membership = member.group_memberships_as_member.where(group_id: group.id, membership_type: membership_type).first_or_initialize
to_add_with_membership_type << membership unless membership.persisted?
end
member.__send__(:clear_association_cache)
Expand Down

0 comments on commit aa8411c

Please sign in to comment.