Attributes in validations should be unique #7354

Closed
wants to merge 1 commit into
from
Jump to file or symbol
Failed to load files and symbols.
+2 −2
Split
@@ -4,7 +4,7 @@ module HelperMethods
private
def _merge_attributes(attr_names)
options = attr_names.extract_options!
- options.merge(:attributes => attr_names.flatten)
+ options.merge(:attributes => attr_names.flatten.uniq)
end
end
@@ -14,7 +14,7 @@ class PresenceValidationTest < ActiveModel::TestCase
end
def test_validate_presences
- Topic.validates_presence_of(:title, :content)
+ Topic.validates_presence_of(:title, :content, :content)
t = Topic.new
assert t.invalid?