lib/couchrest-uniqueness-validation.rb in couchrest-uniqueness-validation-0.2.0 vs lib/couchrest-uniqueness-validation.rb in couchrest-uniqueness-validation-0.2.1
- old
+ new
@@ -22,10 +22,10 @@
protected
def unique?(target)
value = target.validation_property_value(@field_name)
- value.downcase! if @options[:downcase] && !value.blank?
+ value = value.downcase if @options[:downcase] && !value.blank?
existing_docs = target.class.view(@options[:view].to_sym, :key => value, :limit => 1, :include_docs => false)['rows']
# normal case when target.new_document? == true and
# no other document exists
return true if existing_docs.empty?