Skip to content

Commit

Permalink
correct boolean string conversion documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronLasseigne committed Jan 10, 2021
1 parent b4fa18f commit bab1d25
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,9 @@ end

### Boolean

Boolean filters convert the strings `"1"` and `"true"` (case-insensitive) into
`true`. They also convert `"0"` and `"false"` into `false`.
Boolean filters convert the strings `"1"`, `"true"`, and `"on"`
(case-insensitive) into `true`. They also convert `"0"`, `"false"`, and `"off"`
into `false`.

``` rb
class BooleanInteraction < ActiveInteraction::Base
Expand Down Expand Up @@ -684,7 +685,7 @@ class IntegerInteraction < ActiveInteraction::Base
integer :limit1
integer :limit2, base: 8
integer :limit3, base: 0

def execute
[limit1, limit2, limit3]
end
Expand Down
6 changes: 3 additions & 3 deletions lib/active_interaction/filters/boolean_filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ module ActiveInteraction
class Base
# @!method self.boolean(*attributes, options = {})
# Creates accessors for the attributes and ensures that values passed to
# the attributes are Booleans. The strings `"1"` and `"true"`
# (case-insensitive) are converted to `true` while the strings `"0"`
# and `"false"` are converted to `false`.
# the attributes are Booleans. The strings `"1"`, `"true"`, and `"on"`
# (case-insensitive) are converted to `true` while the strings `"0"`,
# `"false"`, and `"off"` are converted to `false`.
#
# @!macro filter_method_params
#
Expand Down

0 comments on commit bab1d25

Please sign in to comment.