Skip to content

Commit 9ee8b08

Browse files
committed
Update inspect output of ActionController::Parameters in docs [skip-ci]
In 74cb9a6 a `#` was added to the inspect of ActionController::Parameters. This change adds `#` to the inspect output of ActionController::Parameters in the documentation.
1 parent f132be4 commit 9ee8b08

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

actionpack/lib/action_controller/metal/strong_parameters.rb

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def initialize # :nodoc:
8181
# })
8282
#
8383
# permitted = params.require(:person).permit(:name, :age)
84-
# permitted # => <ActionController::Parameters {"name"=>"Francesco", "age"=>22} permitted: true>
84+
# permitted # => #<ActionController::Parameters {"name"=>"Francesco", "age"=>22} permitted: true>
8585
# permitted.permitted? # => true
8686
#
8787
# Person.first.update!(permitted)
@@ -111,7 +111,7 @@ def initialize # :nodoc:
111111
#
112112
# params = ActionController::Parameters.new(a: "123", b: "456")
113113
# params.permit(:c)
114-
# # => <ActionController::Parameters {} permitted: true>
114+
# # => #<ActionController::Parameters {} permitted: true>
115115
#
116116
# ActionController::Parameters.action_on_unpermitted_parameters = :raise
117117
#
@@ -442,7 +442,7 @@ def permit!
442442
# either present or the singleton +false+, returns said value:
443443
#
444444
# ActionController::Parameters.new(person: { name: "Francesco" }).require(:person)
445-
# # => <ActionController::Parameters {"name"=>"Francesco"} permitted: false>
445+
# # => #<ActionController::Parameters {"name"=>"Francesco"} permitted: false>
446446
#
447447
# Otherwise raises <tt>ActionController::ParameterMissing</tt>:
448448
#
@@ -570,13 +570,13 @@ def require(key)
570570
# })
571571
#
572572
# params.require(:person).permit(:contact)
573-
# # => <ActionController::Parameters {} permitted: true>
573+
# # => #<ActionController::Parameters {} permitted: true>
574574
#
575575
# params.require(:person).permit(contact: :phone)
576-
# # => <ActionController::Parameters {"contact"=><ActionController::Parameters {"phone"=>"555-1234"} permitted: true>} permitted: true>
576+
# # => #<ActionController::Parameters {"contact"=>#<ActionController::Parameters {"phone"=>"555-1234"} permitted: true>} permitted: true>
577577
#
578578
# params.require(:person).permit(contact: [ :email, :phone ])
579-
# # => <ActionController::Parameters {"contact"=><ActionController::Parameters {"email"=>"[email protected]", "phone"=>"555-1234"} permitted: true>} permitted: true>
579+
# # => #<ActionController::Parameters {"contact"=>#<ActionController::Parameters {"email"=>"[email protected]", "phone"=>"555-1234"} permitted: true>} permitted: true>
580580
#
581581
# If your parameters specify multiple parameters indexed by a number,
582582
# you can permit each set of parameters under the numeric key to be the same using the same syntax as permitting a single item.
@@ -633,7 +633,7 @@ def permit(*filters)
633633
# returns +nil+.
634634
#
635635
# params = ActionController::Parameters.new(person: { name: "Francesco" })
636-
# params[:person] # => <ActionController::Parameters {"name"=>"Francesco"} permitted: false>
636+
# params[:person] # => #<ActionController::Parameters {"name"=>"Francesco"} permitted: false>
637637
# params[:none] # => nil
638638
def [](key)
639639
convert_hashes_to_parameters(key, @parameters[key])
@@ -653,9 +653,9 @@ def []=(key, value)
653653
# is given, then that will be run and its result returned.
654654
#
655655
# params = ActionController::Parameters.new(person: { name: "Francesco" })
656-
# params.fetch(:person) # => <ActionController::Parameters {"name"=>"Francesco"} permitted: false>
656+
# params.fetch(:person) # => #<ActionController::Parameters {"name"=>"Francesco"} permitted: false>
657657
# params.fetch(:none) # => ActionController::ParameterMissing: param is missing or the value is empty: none
658-
# params.fetch(:none, {}) # => <ActionController::Parameters {} permitted: false>
658+
# params.fetch(:none, {}) # => #<ActionController::Parameters {} permitted: false>
659659
# params.fetch(:none, "Francesco") # => "Francesco"
660660
# params.fetch(:none) { "Francesco" } # => "Francesco"
661661
def fetch(key, *args)
@@ -689,8 +689,8 @@ def dig(*keys)
689689
# don't exist, returns an empty hash.
690690
#
691691
# params = ActionController::Parameters.new(a: 1, b: 2, c: 3)
692-
# params.slice(:a, :b) # => <ActionController::Parameters {"a"=>1, "b"=>2} permitted: false>
693-
# params.slice(:d) # => <ActionController::Parameters {} permitted: false>
692+
# params.slice(:a, :b) # => #<ActionController::Parameters {"a"=>1, "b"=>2} permitted: false>
693+
# params.slice(:d) # => #<ActionController::Parameters {} permitted: false>
694694
def slice(*keys)
695695
new_instance_with_inherited_permitted_status(@parameters.slice(*keys))
696696
end
@@ -706,17 +706,17 @@ def slice!(*keys)
706706
# filters out the given +keys+.
707707
#
708708
# params = ActionController::Parameters.new(a: 1, b: 2, c: 3)
709-
# params.except(:a, :b) # => <ActionController::Parameters {"c"=>3} permitted: false>
710-
# params.except(:d) # => <ActionController::Parameters {"a"=>1, "b"=>2, "c"=>3} permitted: false>
709+
# params.except(:a, :b) # => #<ActionController::Parameters {"c"=>3} permitted: false>
710+
# params.except(:d) # => #<ActionController::Parameters {"a"=>1, "b"=>2, "c"=>3} permitted: false>
711711
def except(*keys)
712712
new_instance_with_inherited_permitted_status(@parameters.except(*keys))
713713
end
714714

715715
# Removes and returns the key/value pairs matching the given keys.
716716
#
717717
# params = ActionController::Parameters.new(a: 1, b: 2, c: 3)
718-
# params.extract!(:a, :b) # => <ActionController::Parameters {"a"=>1, "b"=>2} permitted: false>
719-
# params # => <ActionController::Parameters {"c"=>3} permitted: false>
718+
# params.extract!(:a, :b) # => #<ActionController::Parameters {"a"=>1, "b"=>2} permitted: false>
719+
# params # => #<ActionController::Parameters {"c"=>3} permitted: false>
720720
def extract!(*keys)
721721
new_instance_with_inherited_permitted_status(@parameters.extract!(*keys))
722722
end
@@ -726,7 +726,7 @@ def extract!(*keys)
726726
#
727727
# params = ActionController::Parameters.new(a: 1, b: 2, c: 3)
728728
# params.transform_values { |x| x * 2 }
729-
# # => <ActionController::Parameters {"a"=>2, "b"=>4, "c"=>6} permitted: false>
729+
# # => #<ActionController::Parameters {"a"=>2, "b"=>4, "c"=>6} permitted: false>
730730
def transform_values
731731
return to_enum(:transform_values) unless block_given?
732732
new_instance_with_inherited_permitted_status(

0 commit comments

Comments
 (0)