Preload tags with acts-as-taggable-on

Posted . Visible to the public.

When you do tags with acts-as-taggable-on Show archive.org snapshot and want to preload associated tags, you can do so with

TaggedModel.scoped(:include => :tag)

Note however that this will only prevent tagged_model.tags from hitting the database. Using tagged_model.tag_list does not use the preloaded association.

Henning Koch
License
Source code in this card is licensed under the MIT License.
Posted by Henning Koch to makandra dev (2010-10-08 14:43)