From f75893b927a65d9b0550ac5a9ad8f9a49c28b28f Mon Sep 17 00:00:00 2001 From: Simone Carletti Date: Mon, 21 Feb 2011 11:27:35 +0100 Subject: [PATCH] Fixed UniquenessValidator error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1) Validations Uniqueness should not validate a non-unique document Failure/Error: @obj.errors[:title].should eql(['is already taken']) expected ["is already taken"] got ["translation missing: en.activemodel.errors.models.with_unique_validation.attributes.title.taken"] (compared using eql?) Diff: @@ -1,2 +1,2 @@ -["is already taken"] +["translation missing: en.activemodel.errors.models.with_unique_validation.attributes.title.taken"] # ./spec/couchrest/validations_spec.rb:28:in `block (3 levels) in ' Signed-off-by: Marcos Tapajós --- lib/couchrest/model/validations/uniqueness.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/couchrest/model/validations/uniqueness.rb b/lib/couchrest/model/validations/uniqueness.rb index 755cdf3..e2fc794 100644 --- a/lib/couchrest/model/validations/uniqueness.rb +++ b/lib/couchrest/model/validations/uniqueness.rb @@ -32,7 +32,7 @@ module CouchRest end if docs.length > 0 - document.errors.add(attribute, :taken, :default => options[:message], :value => value) + document.errors.add(attribute, :taken, options.merge(:value => value)) end end