From 88f49ee5e665ec7822f98cbeee8f0fe9a4d5776d Mon Sep 17 00:00:00 2001 From: chiu Date: Tue, 12 Nov 2019 20:18:17 +0800 Subject: [PATCH] Update galleries_controller.rb fix auto multiple creating tag --- app/controllers/galleries_controller.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/controllers/galleries_controller.rb b/app/controllers/galleries_controller.rb index e485cb0..1d06cba 100644 --- a/app/controllers/galleries_controller.rb +++ b/app/controllers/galleries_controller.rb @@ -16,6 +16,22 @@ class GalleriesController < ApplicationController tag1.save tags << tag0 tags << tag1 + elsif find_tag.length>1 + show_tags = Tag.all.select{|value| value.name==I18n.t('gallery.show_desc')} + show_tags.each_with_index do |show_tag,index1| + if index1>0 + if show_tag.taggings.count==0 + show_tag.delete + end + end + end + find_tag.each_with_index do |not_show_tag,index1| + if index1>0 + if not_show_tag.taggings.count==0 + not_show_tag.delete + end + end + end end def index