王筝的博客
ruby学习
- validates :name, presence: true, uniqueness: { conditions: -> { where(:state.ne => 2) } }, length: { maximum: 9 }
+ validates :name, presence: true, length: { maximum: 9 }

validates :name, presence: true, uniqueness: { conditions: -> { where(:state.ne => 2) }, scope: :version}, length: { maximum: 9 }

Leave a Reply