Sha256: a568003da9900e9a55e6de5ac3397436d7bddb29de770b6745b704bb57452f7d
Contents?: true
Size: 849 Bytes
Versions: 8
Compression:
Stored size: 849 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.delete("tags/#{to_delete.id}") unless to_delete.nil? 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
8 entries across 8 versions & 2 rubygems