Skip to content
maxime edited this page Sep 13, 2010 · 13 revisions

What is dm-is-taggable?

It’s providing tagging support to Datamapper ressources.

How to install?

  • git clone git://github.com/maxime/dm-is-taggable.git
  • cd dm-is-taggable
  • sudo rake install

How to use it?

  • dependency ‘dm-is-taggable’ in your init.rb
  • In your model:

class Post
  include DataMapper::Resource

  property :id, Serial
  property :name, String
  property :description, Text

  is :taggable
end

  • Example of use:

    post = Post.create(:name => "My First Post")
tasty = Tag.build(‘tasty’) original = Tag.build(‘original’) post.tag(tasty) post.tag(original) post.tags # returns [tasty, original] tasty.posts # returns [post] original.posts # returns [post] post.untag(tasty) post.tags.reload post.tags # returns [original]


Todo

  • More Specs / Testing
  • Tagger Support
  • A form helper
Clone this wiki locally