From 95052427a29e3ea436143c402ab94aa96c2835d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Luis=20Leal=20Cardoso=20Junior?= Date: Sat, 2 Sep 2023 22:35:29 -0300 Subject: [PATCH] Update documentation regarding finding users outside a web session --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 109b61ec..daa73a3f 100644 --- a/README.md +++ b/README.md @@ -807,10 +807,16 @@ conduct experiments that are not tied to a web session. ```ruby # create a new experiment experiment = Split::ExperimentCatalog.find_or_create('color', 'red', 'blue') + +# find the user +user = Split::User.find(user_id, :redis) + # create a new trial -trial = Split::Trial.new(:experiment => experiment) +trial = Split::Trial.new(user: user, experiment: experiment) + # run trial trial.choose! + # get the result, returns either red or blue trial.alternative.name