Module: ActsAsTaggableOn::Taggable

Defined in:
lib/acts-as-taggable-on/taggable.rb,
lib/acts-as-taggable-on/taggable/core.rb,
lib/acts-as-taggable-on/taggable/caching.rb,
lib/acts-as-taggable-on/taggable/related.rb,
lib/acts-as-taggable-on/taggable/ownership.rb,
lib/acts-as-taggable-on/taggable/collection.rb,
lib/acts-as-taggable-on/taggable/tag_list_type.rb,
lib/acts-as-taggable-on/taggable/tagged_with_query.rb,
lib/acts-as-taggable-on/taggable/tagged_with_query/query_base.rb,
lib/acts-as-taggable-on/taggable/tagged_with_query/all_tags_query.rb,
lib/acts-as-taggable-on/taggable/tagged_with_query/any_tags_query.rb,
lib/acts-as-taggable-on/taggable/tagged_with_query/exclude_tags_query.rb

Defined Under Namespace

Modules: Caching, Collection, Core, Ownership, Related, TaggedWithQuery Classes: TagListType

Instance Method Summary collapse

Instance Method Details

#acts_as_ordered_taggableObject

This is an alias for calling acts_as_ordered_taggable_on :tags.

Example:

class Book < ActiveRecord::Base
  acts_as_ordered_taggable
end


27
28
29
# File 'lib/acts-as-taggable-on/taggable.rb', line 27

def acts_as_ordered_taggable
  acts_as_ordered_taggable_on :tags
end

#acts_as_ordered_taggable_on(*tag_types) ⇒ Object

Make a model taggable on specified contexts and preserves the order in which tags are created

Example:

class User < ActiveRecord::Base
  acts_as_ordered_taggable_on :languages, :skills
end

Parameters:

  • tag_types (Array)

    An array of taggable contexts



54
55
56
# File 'lib/acts-as-taggable-on/taggable.rb', line 54

def acts_as_ordered_taggable_on(*tag_types)
  taggable_on(true, tag_types)
end

#acts_as_taggableObject

This is an alias for calling acts_as_taggable_on :tags.

Example:

class Book < ActiveRecord::Base
  acts_as_taggable
end


16
17
18
# File 'lib/acts-as-taggable-on/taggable.rb', line 16

def acts_as_taggable
  acts_as_taggable_on :tags
end

#acts_as_taggable_on(*tag_types) ⇒ Object

Make a model taggable on specified contexts.

Example:

class User < ActiveRecord::Base
  acts_as_taggable_on :languages, :skills
end

Parameters:

  • tag_types (Array)

    An array of taggable contexts



40
41
42
# File 'lib/acts-as-taggable-on/taggable.rb', line 40

def acts_as_taggable_on(*tag_types)
  taggable_on(false, tag_types)
end

#acts_as_taggable_tenant(tenant) ⇒ Object



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/acts-as-taggable-on/taggable.rb', line 58

def acts_as_taggable_tenant(tenant)
  if taggable?
  else
    class_attribute :tenant_column
  end
  self.tenant_column = tenant

  # each of these add context-specific methods and must be
  # called on each call of taggable_on
  include Core
  include Collection
  include Caching
  include Ownership
  include Related
end

#taggable?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/acts-as-taggable-on/taggable.rb', line 5

def taggable?
  false
end