summaryrefslogtreecommitdiff
path: root/app/models/experiment.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/experiment.rb')
-rw-r--r--app/models/experiment.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/models/experiment.rb b/app/models/experiment.rb
index a4cacab25ee..7dbc95f617a 100644
--- a/app/models/experiment.rb
+++ b/app/models/experiment.rb
@@ -16,7 +16,9 @@ class Experiment < ApplicationRecord
# Create or update the recorded experiment_user row for the user in this experiment.
def record_user_and_group(user, group_type, context = {})
- experiment_users.find_or_initialize_by(user: user).update!(group_type: group_type, context: context)
+ experiment_user = experiment_users.find_or_initialize_by(user: user)
+ merged_context = experiment_user.context.deep_merge(context.deep_stringify_keys)
+ experiment_user.update!(group_type: group_type, context: merged_context)
end
def record_conversion_event_for_user(user)