Removing tags with acts_as_taggable plugin?

I’m adapting the acts_as_taggable plugin and it strikes me as odd that
nobody seems to have ever dealt with the fact that it doesn’t include a
means to remove tags. It’s recommended in the Rails Recipes book and
I’ve seen other posters on the mailing list and Rails Wiki recommending
it, but hasn’t anybody ever wanted to remove a tag?

I’m just learning more about polymorphic associations, so I’m sure it
will be clear once I understand them more, but for now I am having
trouble working out how to do a few things:

  1. remove a specific tag from an object
  2. determine if an object includes a tag named X
  3. make sure all the tags on my object are unique, that it doesn’t have
    duplicated tag names

Any pointers?
Thanks!

Jeff

  1. haven’t implemented that so I can’t tell you
  2. mytaggedobject.tags.find_by_name(tagiamlookingfor)
  3. you’ll have to add this yourself in acts_as_taggable.rb, using uniq
    to filter the list passed in by the user should work I think.

Good Luck!

On Jan 25, 6:28 pm, Jeff C.man [email protected]

My acts_as_taggable_on_steroids plugin may be of use. I added the
uniqueness
checking for tag names just today, what good timing ;).

http://svn.viney.net.nz/things/rails/plugins/acts_as_taggable_on_steroids

-Jonathan.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs