Module | Cms::Behaviors::Taggable::InstanceMethods |
In: |
lib/cms/behaviors/taggable.rb
|
# File lib/cms/behaviors/taggable.rb, line 42 42: def save_tags 43: tag_list_tags = tag_list.to_s.split(self.class.tag_separator).map{|t| Tag.find_or_create_by_name(t.strip) } 44: taggings.each do |tg| 45: if tag_list_tags.include?(tg.tag) 46: tag_list_tags.delete(tg.tag) 47: else 48: tg.destroy 49: end 50: end 51: tag_list_tags.each{|t| taggings.create(:tag => t, :taggable => self) } 52: self.tag_list = nil 53: end
# File lib/cms/behaviors/taggable.rb, line 35 35: def tag_list 36: @tag_list ||= tags.reload.map(&:name).join(self.class.tag_separator) 37: end