Sha256: a55482b21944f1f62815857c2a67f3fea2ec5f77df661a1b2adcc512d6428473

Contents?: true

Size: 608 Bytes

Versions: 13

Compression:

Stored size: 608 Bytes

Contents

require './helper'

MongoMapperExt.init

class TagsEx
  include MongoMapper::Document
  include MongoMapperExt::Tags

  key :title
end

TagsEx.delete_all
TagsEx.create!(:title => "The title of the blogpost!!!", :tags => ["tag1", "tag2", "tag3"])
TagsEx.create!(:title => "testing tags", :tags => ["tag1", "tag4", "tag2"])
TagsEx.create!(:title => "more tags", :tags => ["tag1", "tag3", "tag5"])

puts ">> Tag Cloud"
puts TagsEx.tag_cloud.inspect

puts ">> with tag = tag5"
puts TagsEx.find_with_tags("tag5").inspect

puts ">> all tags that start with t"
puts TagsEx.find_tags(/^t/).inspect

TagsEx.delete_all

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
mongomapper_ext-0.5.2 examples/tags.rb
mongomapper_ext-0.5.1 examples/tags.rb
mongomapper_ext-0.5.0 examples/tags.rb
mongomapper_ext-0.4.0 examples/tags.rb
mongomapper_ext-0.3.0 examples/tags.rb
mongomapper_ext-0.2.4 examples/tags.rb
mongomapper_ext-0.2.3 examples/tags.rb
mongomapper_ext-0.2.2 examples/tags.rb
mongomapper_ext-0.2.1 examples/tags.rb
mongomapper_ext-0.2.0 examples/tags.rb
mongomapper_ext-0.1.5 examples/tags.rb
mongomapper_ext-0.1.4 examples/tags.rb
mongomapper_ext-0.1.3 examples/tags.rb