Support numeric inputs for the category
This commit is contained in:
@@ -87,7 +87,14 @@ class Tag < ApplicationRecord
|
||||
end
|
||||
|
||||
def value_for(string)
|
||||
TagCategory.mapping[string.to_s.downcase] || 0
|
||||
norm_string = string.to_s.downcase
|
||||
if norm_string =~ /#{TagCategory.category_ids_regex}/
|
||||
norm_string.to_i
|
||||
elsif TagCategory.mapping[string.to_s.downcase]
|
||||
TagCategory.mapping[string.to_s.downcase]
|
||||
else
|
||||
0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user