Skip to content

Commit 6f63abd

Browse files
committed
Fix an incorrect example in the doc of the Strong Parameters [ci skip]
This PR fixes an incorrect example in the doc of the Strong Parameters. Calling `permitted?` on an array object will raise a `NoMethodError`: ```ruby params = ActionController::Parameters.new(tags: ["rails", "parameters"]) # => #<ActionController::Parameters {"tags"=>["rails", "parameters"]} permitted: false> permitted = params.expect(tags: []) # => ["rails", "parameters"] permitted.permitted? # => undefined method `permitted?' for an instance of Array (NoMethodError) ``` In the documentation example, the value of the `permitted` variable is explicitly shown instead.
1 parent e052362 commit 6f63abd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

actionpack/lib/action_controller/metal/strong_parameters.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ def permit(*filters)
765765
#
766766
# params = ActionController::Parameters.new(tags: ["rails", "parameters"])
767767
# permitted = params.expect(tags: [])
768-
# permitted.permitted? # => true
768+
# permitted # => ["rails", "parameters"]
769769
# permitted.is_a?(Array) # => true
770770
# permitted.size # => 2
771771
#

0 commit comments

Comments
 (0)