From 131dd3fea83e3e9a7fc9aa1cfc2c862c84f18597 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Wed, 4 Sep 2013 13:10:09 +0800 Subject: [PATCH] child images tag adding and deleting updated. --- .../panel/gallery/back_end/albums_controller.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/albums_controller.rb b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/albums_controller.rb index bfb158a7..5ac21b80 100644 --- a/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/albums_controller.rb +++ b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/albums_controller.rb @@ -195,8 +195,18 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController end def update_children_image_tag(tagsToDestroy,tagsToAdd) + debugger # tagsToDestroy will contain all tag ids which have to be deleted from the galley_images # tagsToAdd will contain all tag ids which ve to be added in tall gallery_images - + @images = GalleryImage.all + @images.each do |image| + image.tagged_ids.concat(tagsToAdd) + tagsToDestroy.each do |tag| + if image.tagged_ids.include?tag + image.tagged_ids.delete(tag) + end + end + image.save + end end end