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 4a22a813..18887d10 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 @@ -124,8 +124,9 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController delete_out_invalid_date_from_params respond_to do |format| - if @bulletin.update_attributes(params[:bulletin]) - + if @bulletin.update_attributes(params[:bulletin]) + @bulletin.get_bulletin_tags + format.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('bulletin.update_bulletin_success')) } format.js { render 'toggle_enable' } format.xml { head :ok } diff --git a/vendor/built_in_modules/announcement/app/models/bulletin.rb b/vendor/built_in_modules/announcement/app/models/bulletin.rb index 5ba34da9..cd1ae33a 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin.rb @@ -38,7 +38,7 @@ class Bulletin accepts_nested_attributes_for :bulletin_links, :allow_destroy => true validates :title, :at_least_one => true - after_save :get_bulletin_tags + # after_save :get_bulletin_tags def to_indexed_json self.to_json @@ -68,13 +68,12 @@ class Bulletin end def get_bulletin_tags - if self.changed? - tag = [] - tag << self.tags.map{|t| t.id.to_s}.uniq - # Rails.logger.info"@@@@@@@@@@@@@@@@"+tag.inspect - self.tagged_ids = tag - # self.upsert - end + @tags = self.tags.collect{|t| t.id.to_s}.uniq + tag = [] + tag << @tags + self.tagged_ids << @tags + tags = self.tagged_ids.delete(tag.first) + save end def share_item