Fix for tags

This commit is contained in:
saurabhbhatia 2013-12-31 12:01:11 +08:00
parent caef586691
commit 684f2c75be
2 changed files with 8 additions and 3 deletions

View File

@ -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

View File

@ -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