# Duplicate entry issue in acts\_as\_taggable gem

**URL:** <https://www.ruby-forum.com/t/duplicate-entry-issue-in-acts-as-taggable-gem/63612>\
**Category:** Rails\
**Created:** [June 16, 2006, 5:27pm UTC](https://www.ruby-forum.com/t/duplicate-entry-issue-in-acts-as-taggable-gem/63612 "2006-06-16T17:27:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![hariraj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/4491bb/32.png) [@hariraj](https://www.ruby-forum.com/u/hariraj)\
**Post date:** [June 16, 2006, 5:27pm UTC](https://www.ruby-forum.com/t/duplicate-entry-issue-in-acts-as-taggable-gem/63612/1 "2006-06-16T17:27:38Z")

</div>

Hi,

I am using the ‘acts\_as\_taggable’ gem and have issues when I try to  
‘tag’ an entity with a ‘tagname’ already defined.

i.e

1. book[1].tag(‘science’,‘paperback’) --\> works fine
2. book[2].tag(‘roman’,‘physics’,‘paperback’) --\> creates an exception  
for “paperback” as this tag is already existing in the ‘tags’ db.

Did anybody faced such issue?

I thought this a normal scenario…so not sure whether I am using it in  
a wrong way.

Any ideas?

Thanks, Hari

---

<div class="post-metadata">

**Author:** ![hariraj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/4491bb/32.png) [@hariraj](https://www.ruby-forum.com/u/hariraj)\
**Post date:** [June 16, 2006, 6:07pm UTC](https://www.ruby-forum.com/t/duplicate-entry-issue-in-acts-as-taggable-gem/63612/2 "2006-06-16T18:07:46Z")

</div>

try:  
book[1].tag\_with("science paperback)  
book[2].tag\_with(“roman physics paperback”)

Otherwise you are not using the tagging engine to tag but just the old  
school has\_many.

On 6/16/06, Nara H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

–

---

<div class="post-metadata">

**Author:** ![hariraj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/4491bb/32.png) [@hariraj](https://www.ruby-forum.com/u/hariraj)\
**Post date:** [June 16, 2006, 11:40pm UTC](https://www.ruby-forum.com/t/duplicate-entry-issue-in-acts-as-taggable-gem/63612/3 "2006-06-16T23:40:43Z")

</div>

Hi JÃ³n,

I am using the ‘gem’ version of acts\_as\_taggable and there is no  
“tag\_with” option.

Does the following work with the module version?

\_Hari

JÃ³n BorgÃ¾Ã³rsson wrote:

> try:  
> book[1].tag\_with("science paperback)  
> book[2].tag\_with(“roman physics paperback”)
> 
> Otherwise you are not using the tagging engine to tag but just the old  
> school has\_many.
> 
> On 6/16/06, Nara H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> > 
> > * * *
> > 
> > Rails mailing list  
> > removed\_email\_address@domain.invalid  
> > [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)
> 
> –

---

<div class="post-metadata">

**Author:** ![hariraj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/4491bb/32.png) [@hariraj](https://www.ruby-forum.com/u/hariraj)\
**Post date:** [June 17, 2006, 12:16pm UTC](https://www.ruby-forum.com/t/duplicate-entry-issue-in-acts-as-taggable-gem/63612/4 "2006-06-17T12:16:54Z")

</div>

In almost all cases. If you have a choice between a gem or a plugin.  
Choose the plugin.

On 6/17/06, Nara H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > > school has\_many.
> > > 
> > > –
> 
> –  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

–

---

<div class="post-metadata">

**Author:** ![hariraj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/4491bb/32.png) [@hariraj](https://www.ruby-forum.com/u/hariraj)\
**Post date:** [June 17, 2006, 9:56am UTC](https://www.ruby-forum.com/t/duplicate-entry-issue-in-acts-as-taggable-gem/63612/5 "2006-06-17T09:56:48Z")

</div>

I have tried with the “plugin” version and it doesn’t have this problem.

No idea what the issue with the gem!

\_Hari

Nara H. wrote:

> Hi JÃ³n,
> 
> I am using the ‘gem’ version of acts\_as\_taggable and there is no  
> “tag\_with” option.
> 
> Does the following work with the module version?
> 
> \_Hari
> 
> JÃ³n BorgÃ¾Ã³rsson wrote:
> 
> > try:  
> > book[1].tag\_with("science paperback)  
> > book[2].tag\_with(“roman physics paperback”)
> > 
> > Otherwise you are not using the tagging engine to tag but just the old  
> > school has\_many.
> > 
> > On 6/16/06, Nara H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> > 
> > > Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> > > 
> > > * * *
> > > 
> > > Rails mailing list  
> > > removed\_email\_address@domain.invalid  
> > > [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)
> > 
> > –
