mirror of
https://github.com/neocities/neocities.git
synced 2025-07-06 19:13:27 +02:00
fix for tag create/find
This commit is contained in:
parent
ea45da0dbd
commit
c4487af180
2 changed files with 6 additions and 2 deletions
|
@ -17,7 +17,11 @@ class Tag < Sequel::Model
|
|||
def self.create_unless_exists(name)
|
||||
name = clean_name name
|
||||
return nil if name == '' || name.nil?
|
||||
dataset.filter(name: name).first || create(name: name)
|
||||
begin
|
||||
dataset.filter(name: name).first || create(name: name)
|
||||
rescue Sequel::UniqueConstraintViolation
|
||||
dataset.filter(name: name).first
|
||||
end
|
||||
end
|
||||
|
||||
def self.autocomplete(name, limit=3)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue