Skip to content

Commit

Permalink
Fix example code in README
Browse files Browse the repository at this point in the history
- A method that has `?` suffix should return boolean, but this method return an object that respond to `valid?`.
- All other examples don't have `?`.
  • Loading branch information
tricknotes committed Jan 6, 2023
1 parent 8d9fd4e commit 56ae1fd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require "scientist"
class MyWidget
def allows?(user)
experiment = Scientist::Default.new "widget-permissions"
experiment.use { model.check_user?(user).valid? } # old way
experiment.use { model.check_user(user).valid? } # old way
experiment.try { user.can?(:read, model) } # new way

experiment.run
Expand Down

0 comments on commit 56ae1fd

Please sign in to comment.