FIX: unable to remove required tag group from a category

This commit is contained in:
Neil Lalonde
2019-11-18 15:54:00 -05:00
parent 228c4814be
commit a4dbec5bf9
3 changed files with 19 additions and 1 deletions

View File

@@ -281,6 +281,7 @@ class CategoriesController < ApplicationController
if SiteSetting.tagging_enabled
params[:allowed_tags] ||= []
params[:allowed_tag_groups] ||= []
params[:required_tag_group_name] ||= ''
end
result = params.permit(

View File

@@ -559,7 +559,7 @@ class Category < ActiveRecord::Base
end
def required_tag_group_name=(group_name)
self.required_tag_group = group_name ? TagGroup.where(name: group_name).first : nil
self.required_tag_group = group_name.blank? ? nil : TagGroup.where(name: group_name).first
end
def downcase_email