Skip to content

Commit 9505242

Browse files
committed
Update documentation regarding finding users outside a web session
1 parent 074b502 commit 9505242

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

README.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -807,10 +807,16 @@ conduct experiments that are not tied to a web session.
807807
```ruby
808808
# create a new experiment
809809
experiment = Split::ExperimentCatalog.find_or_create('color', 'red', 'blue')
810+
811+
# find the user
812+
user = Split::User.find(user_id, :redis)
813+
810814
# create a new trial
811-
trial = Split::Trial.new(:experiment => experiment)
815+
trial = Split::Trial.new(user: user, experiment: experiment)
816+
812817
# run trial
813818
trial.choose!
819+
814820
# get the result, returns either red or blue
815821
trial.alternative.name
816822

0 commit comments

Comments
 (0)