File tree Expand file tree Collapse file tree 3 files changed +16
-0
lines changed
lib/action_controller/metal
test/controller/parameters Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Original file line number Diff line number Diff line change
1
+ * Add ` without ` as an alias of ` except ` on ` ActiveController::Parameters ` .
2
+
3
+ * Hidde-Jan Jongsma*
4
+
1
5
* Expand search field on ` rails/info/routes ` to also search ** route name** , ** http verb** and ** controller#action** .
2
6
3
7
* Jason Kotchoff*
Original file line number Diff line number Diff line change @@ -734,6 +734,7 @@ def slice!(*keys)
734
734
def except ( *keys )
735
735
new_instance_with_inherited_permitted_status ( @parameters . except ( *keys ) )
736
736
end
737
+ alias_method :without , :except
737
738
738
739
# Removes and returns the key/value pairs matching the given keys.
739
740
#
Original file line number Diff line number Diff line change @@ -149,6 +149,17 @@ class ParametersAccessorsTest < ActiveSupport::TestCase
149
149
assert_not_predicate @params [ :person ] . except ( :name ) , :permitted?
150
150
end
151
151
152
+ test "without retains permitted status" do
153
+ @params . permit!
154
+ assert_predicate @params . without ( :person ) , :permitted?
155
+ assert_predicate @params [ :person ] . without ( :name ) , :permitted?
156
+ end
157
+
158
+ test "without retains unpermitted status" do
159
+ assert_not_predicate @params . without ( :person ) , :permitted?
160
+ assert_not_predicate @params [ :person ] . without ( :name ) , :permitted?
161
+ end
162
+
152
163
test "exclude? returns true if the given key is not present in the params" do
153
164
assert @params . exclude? ( :address )
154
165
end
You can’t perform that action at this time.
0 commit comments