Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #6668 from pomnikita/master

Compact array of values added to PermissionSet instance
  • Loading branch information...
commit 41d63710f22065c16582125873a4e3c14357bd7f 2 parents d1136e6 + 00ff0a6
Piotr Sarnacki drogus authored
2  activemodel/lib/active_model/mass_assignment_security/permission_set.rb
View
@@ -5,7 +5,7 @@ module MassAssignmentSecurity
class PermissionSet < Set
def +(values)
- super(values.map(&:to_s))
+ super(values.compact.map(&:to_s))
end
def include?(key)
6 activemodel/test/cases/mass_assignment_security/permission_set_test.rb
View
@@ -13,6 +13,12 @@ def setup
assert new_list.include?('admin'), "did not add collection to #{@permission_list.inspect}}"
end
+ test "+ compacts added collection values" do
+ added_collection = [ nil ]
+ new_list = @permission_list + added_collection
+ assert_equal new_list, @permission_list, "did not add collection to #{@permission_list.inspect}}"
+ end
+
test "include? normalizes multi-parameter keys" do
multi_param_key = 'admin(1)'
new_list = @permission_list += [ 'admin' ]
Please sign in to comment.
Something went wrong with that request. Please try again.