Sha256: be74907d0329e2bd340fc86e687ccc0a5d92e3fbf50560aa2bda1b9b37e687ee

Contents?: true

Size: 483 Bytes

Versions: 1

Compression:

Stored size: 483 Bytes

Contents

module Highrise
  module Taggable        
    def tags
      self.get(: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.1.6 lib/highrise/taggable.rb