Skip to content

Commit

Permalink
Update documentation regarding finding users outside a web session
Browse files Browse the repository at this point in the history
  • Loading branch information
andrehjr committed Sep 3, 2023
1 parent 074b502 commit 9505242
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9505242

Please sign in to comment.