Sha256: 2752b88cb21ed3c5c2295094e615b10bc5739aa339f1341c0c60fb729aec797a
Contents?: true
Size: 913 Bytes
Versions: 5
Compression:
Stored size: 913 Bytes
Contents
module Highrise module Taggable # thanks for the user Inka, http://forum.37signals.com/highrise/forums/15/topics/1312?page=2 def tag!(tag_name) self.post(:tags, :name => tag_name) unless tag_name.blank? end def untag!(tag_name) to_delete = self.tags.find{|t| t.name==tag_name} unless tag_name.blank? self.untag_id!(to_delete.id) unless to_delete.nil? end def untag_id!(tag_id) self.delete("tags/#{tag_id}") end def tags tags = [] get_document.search("#show_tags a").each{ |a| tags << Highrise::Tag.new(:id => a['href'].gsub(/.*\//, ''), :name => a.inner_html) if a['class'] == "grey tag" } tags end def get_document @curl_helper ||= CurlHelper.new @doc = @curl_helper.get_document_from_id("#{self.class.collection_name}/#{self.id}") end end end
Version data entries
5 entries across 5 versions & 2 rubygems