On Nov 6, 2014, at 1:40 PM, Ryan Moser <ryanpmo...@gmail.com> wrote:
> I find it a bit odd that validates_uniqueness_of always hits the database > even when the attribute we are concerned with has not changed. It's easy > enough to add a dirty checking condition to a uniqueness validation, but it > seems like this should be the default behavior and always running the > validation should require some sort of a flag. Would this change be accepted? > You can get the behavior you want with an `if` option, I believe: validates_uniqueness_of :foo, if: :foo_changed? The behavior of all the *other* validations is “run every time the record is saved”, so I don’t think it would make sense for one of them to be different out-of-the-box. —Matt Jones
signature.asc
Description: Message signed with OpenPGP using GPGMail