Skip to content

Commit

Permalink
Merge pull request #716 from splitrb/fix-outside-web-session-details-…
Browse files Browse the repository at this point in the history
…readme

Update documentation regarding finding users outside a web session
  • Loading branch information
andrehjr authored Sep 3, 2023
2 parents 074b502 + 9505242 commit b401721
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 b401721

Please sign in to comment.