Skip to content

Commit b401721

Browse files
authored
Merge pull request #716 from splitrb/fix-outside-web-session-details-readme
Update documentation regarding finding users outside a web session
2 parents 074b502 + 9505242 commit b401721

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

README.md

Lines changed: 7 additions & 1 deletion
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)