From 684f2c75be53dfb664fc603267a0f728c295c110 Mon Sep 17 00:00:00 2001 From: saurabhbhatia Date: Tue, 31 Dec 2013 12:01:11 +0800 Subject: [PATCH] Fix for tags --- lib/orbit_tag/taggable.rb | 2 +- .../panel/announcement/back_end/bulletins_controller.rb | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/orbit_tag/taggable.rb b/lib/orbit_tag/taggable.rb index cadf2ad6..0faf81b2 100644 --- a/lib/orbit_tag/taggable.rb +++ b/lib/orbit_tag/taggable.rb @@ -15,7 +15,7 @@ module OrbitTag has_many :taggings, as: :taggable, autosave: true, dependent: :destroy accepts_nested_attributes_for :taggings, allow_destroy: true - after_save :remove_taggings, unless: Proc.new{self.tags_to_destroy.blank?} + # after_save :remove_taggings, unless: Proc.new{self.tags_to_destroy.blank?} end send :include, InstanceMethods end diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb index c653d466..4a4416b1 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb @@ -122,6 +122,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController def update @bulletin = Bulletin.find(params[:id]) + # @bulletin.image.clear if params[:bulletin][:image_del] == '1' # if params[:bulletin][:image_del] == '1' # @bulletin.remove_image! @@ -132,8 +133,12 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController delete_out_invalid_date_from_params respond_to do |format| if @bulletin.update_attributes(params[:bulletin]) - @bulletin.tagged_ids = @bulletin.tag_ids if params[:bulletin][:tag_ids].nil? - @bulletin.save + tag = [] + length = (@bulletin.tag_ids.length / 2) + @bulletin.tag_ids.each do |t| + tag << t.to_s + end + @bulletin.set(:tagged_ids, tag.take(length)) # if(is_manager? || is_admin?) # @bulletin.is_checked = true # @bulletin.is_rejected = false