Fix for tags
This commit is contained in:
parent
caef586691
commit
684f2c75be
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Reference in New Issue