class Photo < ActiveRecord::Base
acts_as_taggable
end
photo = Photo.new
# standard tagging with a string
photo.tag 'brazil rio beach'
# tagging with an array
photo.tag ['south america', 'soccer']
# tagging with a different separator
photo.tag 'beautiful women, babes, hot chicks', :separator => ','
# tagging with a Proc separator
photo.tag '2001..2005', :separator => proc { |s| eval(s).to_a }
# suppose your tags_photos join table has attributes
# and you want to set them while you tag
photo.tag 'samba', :attributes => { :tagged_at => Time.now }
# Let´s do some tag searching now
# Photos with soccer OR rio
Photo.find_tagged_with :any => 'soccer rio'
# Photos with beach AND women (combo tags)
Photo.find_tagged_with :all => 'beach woman'
# Using a different separator
Photo.find_tagged_with :all => 'beach+woman', :separator => '+'