Search code examples
ruby-on-railsrubyhighrise

Ruby Highrise API - Add Remove Tags from Person


How can one add and remove tags using the Highrise API. I believe my issue is due to the lack of knowledge in ActiveResources, which Highrise GEM is been based on.

Now I tried some thing like this...

person = Highrise::Person.find(1234)
person.update_attributes(tags: [ { id: 9876, _destroy: true } ])

Though returns true, doesn't remove the tag association.

I would like to know how to remove a tag from a person. Thanks in advance.


Solution

  • Looking at the gem sourcecode, it seems that Highrise::Person is Taggable.

    So you could do :

    person = Highrise::Person.find(1234)
    person.untag!(tag_name)
    

    Note that you need to provide a tag_name, not its id.