# ROR Recipes Beta: Why use taggings instead of tags\_contacts?

**URL:** <https://www.ruby-forum.com/t/ror-recipes-beta-why-use-taggings-instead-of-tags-contacts/66285>\
**Category:** Rails\
**Created:** [February 12, 2006, 11:49pm UTC](https://www.ruby-forum.com/t/ror-recipes-beta-why-use-taggings-instead-of-tags-contacts/66285 "2006-02-12T23:49:57Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![softwareengineer\_99](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b782af/32.png) [@softwareengineer\_99](https://www.ruby-forum.com/u/softwareengineer_99)\
**Post date:** [February 12, 2006, 11:49pm UTC](https://www.ruby-forum.com/t/ror-recipes-beta-why-use-taggings-instead-of-tags-contacts/66285/1 "2006-02-12T23:49:57Z")

</div>

I have gotten acts\_as\_taggable to work for a test application as  
documented on [taggable.rubyforge.org](http://taggable.rubyforge.org)

I am following Chad’s excellent examples in ROR Recipes Beta book.

I have a few questions and hope that Chad or some other expert can  
help clarify them.

1. Why is the book suggesting to use taggings table instead of  
tags\_contacts, as mentioned on [taggable.rubyforge.org](http://taggable.rubyforge.org)?
2. How can I use this taggings table instead of my tags\_contacts?
3. How can I store additional fields such as member\_id in the  
tags\_contacts table or taggings table?
4. When I follow Chad’s example on my Favorite class, (with  
tags\_favorites and taggings table created) I keep getting the  
NoMethodError for “tag\_with”? At first I thought this may be because I  
am using taggings table but then when I created tags\_favorites table  
the error persisted.
5. I finally used the tag method as described on [rubyforge.org](http://rubyforge.org) and it  
works. So my question is, is tag\_with a typo in the book or am I  
missing something?
6. Why does the following output say @new\_record=false even when the  
record was created? Is it to prevent further entry of the same record?

Loading development environment.  
./script/…/config/…/config/…/lib/localization.rb:5: warning:  
already initialized constant LOCALIZED\_STRINGS

> > f=Favorite.create(:url=\>‘[http://home.com](http://home.com)’, :title=\>‘Home Pages  
> > title’, :desc=\>‘My note about this favorite’, :created\_at=\>Time.now)  
> > =\> #\<Favorite:0xb6f5d594 @new\_record=false,  
> > @errors=#\<ActiveRecord::Errors:0xb6f54bb0 @base=#\<Favorite:0xb6f5d594  
> > …\>, @errors={}\>, @new\_record\_before\_save=false,  
> > @attributes={“updated\_at”=\>Sun Feb 12 15:30:38 CST 2006, “title”=\>“Home  
> > Pages title”, “portal\_id”=\>0, “member\_id”=\>0, “id”=\>12,  
> > “url”=\>“[http://home.com](http://home.com)”, “desc”=\>“My note about this favorite”,  
> > “created\_at”=\>Sun Feb 12 15:30:38 CST 2006}\>  
> > f.tag\_with(“home tag1 tag2”)  
> > NoMethodError: undefined method `tag_with' for #<Favorite:0xb6f5d594> from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:1501:in `method\_missing’  
> > from (irb):2  
> > f.tag(“home tag1 tag2”)  
> > =\> [“home”, “tag1”, “tag2”]

Thank you very much for your assistance.

Frank

---

<div class="post-metadata">

**Author:** ![softwareengineer\_99](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b782af/32.png) [@softwareengineer\_99](https://www.ruby-forum.com/u/softwareengineer_99)\
**Post date:** [February 13, 2006, 3:00am UTC](https://www.ruby-forum.com/t/ror-recipes-beta-why-use-taggings-instead-of-tags-contacts/66285/2 "2006-02-13T03:00:37Z")

</div>

The acts\_as\_taggable in the ROR Recipes book uses the _plugin_ written  
by DHH, not the _gem_ on rubyforge. Unfortunately, the plugin is not  
documented outside the ROR Recipes book right now.

Until DHH documents the plugin we’re going to have dozens or hundreds  
of messages of confusion like this. Even then, the namespace collision  
will provide months of amusement.

---

<div class="post-metadata">

**Author:** ![softwareengineer\_99](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b782af/32.png) [@softwareengineer\_99](https://www.ruby-forum.com/u/softwareengineer_99)\
**Post date:** [February 13, 2006, 4:12am UTC](https://www.ruby-forum.com/t/ror-recipes-beta-why-use-taggings-instead-of-tags-contacts/66285/3 "2006-02-13T04:12:55Z")

</div>

Thanks for the clarification.

Michael Y. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote: The  
acts\_as\_taggable in the ROR Recipes book uses the _plugin_ written  
by DHH, not the _gem_ on rubyforge. Unfortunately, the plugin is not  
documented outside the ROR Recipes book right now.

Until DHH documents the plugin we’re going to have dozens or hundreds  
of messages of confusion like this. Even then, the namespace collision  
will provide months of amusement.

---

<div class="post-metadata">

**Author:** ![softwareengineer\_99](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b782af/32.png) [@softwareengineer\_99](https://www.ruby-forum.com/u/softwareengineer_99)\
**Post date:** [February 13, 2006, 8:10am UTC](https://www.ruby-forum.com/t/ror-recipes-beta-why-use-taggings-instead-of-tags-contacts/66285/4 "2006-02-13T08:10:00Z")

</div>

> Until DHH documents the plugin we’re going to have dozens or hundreds  
> of messages of confusion like this. Even then, the namespace collision  
> will provide months of amusement.

Now here’s the truly wonderful part of open source: Creator,  
maintainer, and documentor needs not all be caps on the same schmoe.  
Thus, if you find something useful, say a plugin like acts\_as\_taggable  
with the creator stamp DHH, you can choose to express your gratitude  
through one of the other caps.

## That may be a patch to extend or it may be a tutorial about its usage or even READMEs and RDocs for the source. So try not to assume that creator equals sole maintainer or documentor. Only try to understand the truth: There is no vendor.

David Heinemeier H.  
[http://www.loudthinking.com](http://www.loudthinking.com) – Broadcasting Brain  
[http://www.basecamphq.com](http://www.basecamphq.com) – Online project management  
[http://www.backpackit.com](http://www.backpackit.com) – Personal information manager  
[http://www.rubyonrails.com](http://www.rubyonrails.com) – Web-application framework

---

<div class="post-metadata">

**Author:** ![softwareengineer\_99](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b782af/32.png) [@softwareengineer\_99](https://www.ruby-forum.com/u/softwareengineer_99)\
**Post date:** [February 13, 2006, 12:22pm UTC](https://www.ruby-forum.com/t/ror-recipes-beta-why-use-taggings-instead-of-tags-contacts/66285/5 "2006-02-13T12:22:30Z")

</div>

On 2/13/06, David Heinemeier H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> That may be a patch to extend or it may be a tutorial about its usage  
> or even READMEs and RDocs for the source. So try not to assume that  
> creator equals sole maintainer or documentor. Only try to understand  
> the truth: There is no vendor.

I am actually trying to get a grip on this to help, which happens to  
be challenging for my skill level.

But when the top dog of Rails creates a namespace clash with a  
well-known gem, it sure would be nice to have some leadership and not  
defer to the magic of open-source community to sort it out eventually.  
Better to just say, “We’re up against a new product release, and will  
get to this someday soon,” or somesuch, which is probably pretty close  
to the truth.

Thought experiment: If someone else had released a plugin with the  
same name as a well-known gem, would the community have accepted it,  
or would they encourage the creator to change the name to avoid  
confusion? I assert that 1) the creator would have been encouraged to  
change the name, and 2) it is because DHH is the creator this didn’t  
happen.

Of course, let a thousand flowers bloom, just don’t expect this  
question to go away anytime soon.

---

<div class="post-metadata">

**Author:** ![softwareengineer\_99](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b782af/32.png) [@softwareengineer\_99](https://www.ruby-forum.com/u/softwareengineer_99)\
**Post date:** [February 13, 2006, 3:34pm UTC](https://www.ruby-forum.com/t/ror-recipes-beta-why-use-taggings-instead-of-tags-contacts/66285/6 "2006-02-13T15:34:45Z")

</div>

I have written a weblog entry which hopefully clarifies the situation  
as I understand it, and will eventually hit the Google index for  
future queries.

[http://www.notio.com/2006/02/rails\_acts\_as\_t.html](http://www.notio.com/2006/02/rails_acts_as_t.html)

---

<div class="post-metadata">

**Author:** ![softwareengineer\_99](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b782af/32.png) [@softwareengineer\_99](https://www.ruby-forum.com/u/softwareengineer_99)\
**Post date:** [February 13, 2006, 7:27pm UTC](https://www.ruby-forum.com/t/ror-recipes-beta-why-use-taggings-instead-of-tags-contacts/66285/7 "2006-02-13T19:27:47Z")

</div>

Wow, it feels great to receive a reply from David himself.

Thanks a lot man for the clarification.

You are doing a great job and like other ROR developers, I greatly  
appreciate your efforts.

Frank

David Heinemeier H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote: \> But when  
the top dog of Rails creates a namespace clash with a

> well-known gem, it sure would be nice to have some leadership and not  
> defer to the magic of open-source community to sort it out eventually.

Namespace clashes are problematic for packages that wants to be used  
concurrently, not for alternatives. How would the situation have  
improved if I had called it acts\_as\_polymorphically\_taggable (except  
for making jokes about such a terrible, terrible name)? Would we not  
have had the same questions as to what does what and why? Of course we  
would.

In any case, let me summarize the difference quickly. The main  
difference is not plugin vs gem, but rather that my version of  
acts\_as\_taggable is designed to work with multiple classes. So a  
single tag can be used in the tagging of multiple classes. This  
requires polymorphic associations and join models, which is why it  
only works Edge Rails (and will work in the forthcoming 1.1).

## So if you need that feature, tagging of multiple classes with the same tags, then use my version. Otherwise, the old version is probably better. It’s certainly more feature-rich and better documented.

David Heinemeier H.  
[http://www.loudthinking.com](http://www.loudthinking.com) – Broadcasting Brain  
[http://www.basecamphq.com](http://www.basecamphq.com) – Online project management  
[http://www.backpackit.com](http://www.backpackit.com) – Personal information manager  
[http://www.rubyonrails.com](http://www.rubyonrails.com) – Web-application framework

---

<div class="post-metadata">

**Author:** ![softwareengineer\_99](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b782af/32.png) [@softwareengineer\_99](https://www.ruby-forum.com/u/softwareengineer_99)\
**Post date:** [February 13, 2006, 4:31pm UTC](https://www.ruby-forum.com/t/ror-recipes-beta-why-use-taggings-instead-of-tags-contacts/66285/8 "2006-02-13T16:31:39Z")

</div>

> But when the top dog of Rails creates a namespace clash with a  
> well-known gem, it sure would be nice to have some leadership and not  
> defer to the magic of open-source community to sort it out eventually.

Namespace clashes are problematic for packages that wants to be used  
concurrently, not for alternatives. How would the situation have  
improved if I had called it acts\_as\_polymorphically\_taggable (except  
for making jokes about such a terrible, terrible name)? Would we not  
have had the same questions as to what does what and why? Of course we  
would.

In any case, let me summarize the difference quickly. The main  
difference is not plugin vs gem, but rather that my version of  
acts\_as\_taggable is designed to work with multiple classes. So a  
single tag can be used in the tagging of multiple classes. This  
requires polymorphic associations and join models, which is why it  
only works Edge Rails (and will work in the forthcoming 1.1).

## So if you need that feature, tagging of multiple classes with the same tags, then use my version. Otherwise, the old version is probably better. It’s certainly more feature-rich and better documented.

David Heinemeier H.  
[http://www.loudthinking.com](http://www.loudthinking.com) – Broadcasting Brain  
[http://www.basecamphq.com](http://www.basecamphq.com) – Online project management  
[http://www.backpackit.com](http://www.backpackit.com) – Personal information manager  
[http://www.rubyonrails.com](http://www.rubyonrails.com) – Web-application framework
