From aa8411c91adfb19a9dde1a399efb47522bb7169e Mon Sep 17 00:00:00 2001 From: Joel Van Horn Date: Wed, 10 May 2017 17:12:21 -0400 Subject: [PATCH] Remove `group_type` based on group class because we handle STI separately --- lib/groupify/adapter/active_record/group.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/groupify/adapter/active_record/group.rb b/lib/groupify/adapter/active_record/group.rb index 8810bb0..40396b0 100644 --- a/lib/groupify/adapter/active_record/group.rb +++ b/lib/groupify/adapter/active_record/group.rb @@ -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 @@ -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)