tapajos / highrise

Ruby wrapper around Highrise API.
MIT License
124 stars 77 forks source link

Fix undefined method attributes error in Taggable #65

Closed dior001 closed 10 years ago

dior001 commented 10 years ago

The recent change to taggable.rb line 12.

to_delete = self.tags.find{|tag| tag.attributes['name'] == tag_name} unless tag_name.blank?

exposed an inconsistency in the overridden tags method in the Person class and the tags method in the Taggable class. This meant the untag! method raised an error for tags on the Company class. As Taggable is only used in Company and Person it made sense to me to move this to the Taggable class and eliminate the need for overriding the tags method in the Person class. The error occurring is as follows:

undefined method `attributes' for {"id"=>2237655, "name"=>"Commercial Facility"}:Hash
/app/vendor/bundle/ruby/2.1.0/gems/highrise-3.1.6/lib/highrise/taggable.rb:12
lucasmartins commented 10 years ago

Thanks for the fix!