@@ -726,19 +726,19 @@ def permit(*filters)
726
726
# similar to the `.require.permit` pattern. If multiple root keys are
727
727
# expected, they will all be required.
728
728
#
729
- # params = ActionController::Parameters.new(name: "Martin", pies: [{ type: "dessert", flavor: "pumpkin"}])
730
- # name, pies = params.expect(:name, pies: [[:type, :flavor]])
731
- # name # => "Martin"
732
- # pies # => [#<ActionController::Parameters {"type"=>"dessert", "flavor"=>"pumpkin"} permitted: true>]
729
+ # params = ActionController::Parameters.new(name: "Martin", pies: [{ type: "dessert", flavor: "pumpkin"}])
730
+ # name, pies = params.expect(:name, pies: [[:type, :flavor]])
731
+ # name # => "Martin"
732
+ # pies # => [#<ActionController::Parameters {"type"=>"dessert", "flavor"=>"pumpkin"} permitted: true>]
733
733
#
734
734
# When called with a hash with multiple keys, `expect` will permit the
735
735
# parameters and require the keys in the order they are given in the hash,
736
736
# returning an array of the permitted parameters.
737
737
#
738
- # params = ActionController::Parameters.new(subject: { name: "Martin" }, object: { pie: "pumpkin" })
739
- # subject, object = params.expect(subject: [:name], object: [:pie])
740
- # subject # => #<ActionController::Parameters {"name"=>"Martin"} permitted: true>
741
- # object # => #<ActionController::Parameters {"pie"=>"pumpkin"} permitted: true>
738
+ # params = ActionController::Parameters.new(subject: { name: "Martin" }, object: { pie: "pumpkin" })
739
+ # subject, object = params.expect(subject: [:name], object: [:pie])
740
+ # subject # => #<ActionController::Parameters {"name"=>"Martin"} permitted: true>
741
+ # object # => #<ActionController::Parameters {"pie"=>"pumpkin"} permitted: true>
742
742
#
743
743
# Besides being more strict about array vs hash params, `expect` uses permit
744
744
# internally, so it will behave similarly.
0 commit comments