Permalink
Browse files

No need for an extra wrapper array.

  • Loading branch information...
thedarkone committed Sep 24, 2010
1 parent e12e2fb commit 4c360c15e53324a7e5940f943129a06da51ac7d3
Showing with 1 addition and 1 deletion.
  1. +1 −1 activesupport/lib/active_support/core_ext/hash/keys.rb
@@ -39,7 +39,7 @@ def symbolize_keys!
# { :name => "Rob", :age => "28" }.assert_valid_keys("name", "age") # => raises "ArgumentError: Unknown key(s): name, age"
# { :name => "Rob", :age => "28" }.assert_valid_keys(:name, :age) # => passes, raises nothing
def assert_valid_keys(*valid_keys)
- unknown_keys = keys - [valid_keys].flatten
+ unknown_keys = keys - valid_keys.flatten
raise(ArgumentError, "Unknown key(s): #{unknown_keys.join(", ")}") unless unknown_keys.empty?
end
end

0 comments on commit 4c360c1

Please sign in to comment.