http://ruby.11.x6.nabble.com/validates-uniqueness-of-only-if-present-td2704659.html
nil == nil
returns true in Ruby
So, if we are using 'uniqueness' constraint, it is important to remember to also use
:allow_blank => true
if we are expecting 'nil' values for that column
E.g.
validates_uniqueness_of :c_id, :allow_blank => true
nil == nil
returns true in Ruby
So, if we are using 'uniqueness' constraint, it is important to remember to also use
:allow_blank => true
if we are expecting 'nil' values for that column
E.g.
validates_uniqueness_of :c_id, :allow_blank => true
No comments:
Post a Comment