mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
DEV: allow to have duplicate topic titles if categegory is different (#10034)
Co-authored-by: Robin Ward <robin.ward@gmail.com> Co-authored-by: Robin Ward <robin.ward@gmail.com>
This commit is contained in:
@ -12,7 +12,7 @@ class UniqueAmongValidator < ActiveRecord::Validations::UniquenessValidator
|
||||
# do nothing further unless there were some duplicates.
|
||||
unless new_errors == 0
|
||||
# now look only in the collection we care about.
|
||||
dupes = options[:collection].call.where("lower(#{attribute}) = ?", value.downcase)
|
||||
dupes = options[:collection].call(record).where("lower(#{attribute}) = ?", value.downcase)
|
||||
dupes = dupes.where("id != ?", record.id) if record.persisted?
|
||||
|
||||
# pop off the error, if it was a false positive
|
||||
|
Reference in New Issue
Block a user