The following code was working on rails 2.0 and doesn’t work on 2.1: class Person < ActiveRecord::Base validates_uniqueness_of :email def self.find(*args) with_scope(:find => { :conditions => ["status = ?", true]}) do super end endend >> p1 = Person.new(:email => "test@domain.com", :status => true)=> #<Person id: nil, email: "test@domain.com", status: true>>> p2 = Person.new(:email => "test@domain.com", :status => true)=> #<Person id: nil, email: "test@domain.com", status: true>>> p1.save!=> true>> p2.save!ActiveRecord::RecordInvalid: Validation failed: Email has already been taken>> p1 = Person.find(1)=> #<Person id: 1, email: "test@domain.com", status: true>>> p1.status = false=> false>> p1.save!=> true>> p1 = Person.find(1)ActiveRecord::RecordNotFound: Couldn’t find Person with ID=1>> p2.save!ActiveRecord::RecordInvalid: Validation failed: Email has already been taken>> Person.find :all=> []
6b8051d13ef6f240365e4b8afb4c60754729d967
Merge commit 'efren/master'