forked from treehouse/mastodon
parent
d22f3a7d51
commit
dff46b260b
|
@ -114,7 +114,7 @@ class Tag < ApplicationRecord
|
||||||
class << self
|
class << self
|
||||||
def find_or_create_by_names(name_or_names)
|
def find_or_create_by_names(name_or_names)
|
||||||
Array(name_or_names).map(&method(:normalize)).uniq { |str| str.mb_chars.downcase.to_s }.map do |normalized_name|
|
Array(name_or_names).map(&method(:normalize)).uniq { |str| str.mb_chars.downcase.to_s }.map do |normalized_name|
|
||||||
tag = matching_name(normalized_name).first || create(name: normalized_name)
|
tag = matching_name(normalized_name).first || create!(name: normalized_name)
|
||||||
|
|
||||||
yield tag if block_given?
|
yield tag if block_given?
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue