Sha256: a2107b685677140924b86fbda56f8b6dabfb893134dacbc726fab2b60f9b6ffc
Contents?: true
Size: 694 Bytes
Versions: 1
Compression:
Stored size: 694 Bytes
Contents
module Highrise module Taggable def tags unless self.attributes.has_key?("tags") person_or_company = self.class.find(id) self.attributes["tags"] = person_or_company.attributes.has_key?("tags") ? person_or_company.tags : [] end self.attributes["tags"] end def tag!(tag_name) self.post(:tags, :name => tag_name) unless tag_name.blank? end def untag!(tag_name) to_delete = self.tags.find{|tag| tag.attributes['name'] == tag_name} unless tag_name.blank? self.untag_id!(to_delete.attributes['id']) unless to_delete.nil? end protected def untag_id!(tag_id) self.delete("tags/#{tag_id}") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
highrise-3.2.3 | lib/highrise/taggable.rb |