Module: Taglish::Taggable
- Defined in:
- lib/taglish/taggable.rb
Constant Summary collapse
- SCORED_TAG_REGEX =
/^(.+):(-?\d+)$/
Instance Method Summary collapse
- #ordered_taglish ⇒ Object
-
#ordered_taglish_on(*tag_types) ⇒ Object
Make a model taggable on specified contexts.
- #scored_taglish ⇒ Object
-
#scored_taglish_on(*tag_types) ⇒ Object
Make a model taggable on specified contexts.
- #taggable? ⇒ Boolean
- #taglish ⇒ Object
-
#taglish_on(*tag_types) ⇒ Object
Make a model taggable on specified contexts.
Instance Method Details
#ordered_taglish ⇒ Object
13 14 15 |
# File 'lib/taglish/taggable.rb', line 13 def ordered_taglish ordered_taglish_on(:tags) end |
#ordered_taglish_on(*tag_types) ⇒ Object
Make a model taggable on specified contexts.
Example:
class User < ActiveRecord::Base
scored_taglish_on :languages, :skills
end
56 57 58 |
# File 'lib/taglish/taggable.rb', line 56 def ordered_taglish_on(*tag_types) taggable_on(true, false, tag_types) end |
#scored_taglish ⇒ Object
17 18 19 |
# File 'lib/taglish/taggable.rb', line 17 def scored_taglish scored_taglish_on(:tags) end |
#scored_taglish_on(*tag_types) ⇒ Object
Make a model taggable on specified contexts.
Example:
class User < ActiveRecord::Base
scored_taglish_on :languages, :skills
end
30 31 32 |
# File 'lib/taglish/taggable.rb', line 30 def scored_taglish_on(*tag_types) taggable_on(false, true, tag_types) end |
#taggable? ⇒ Boolean
5 6 7 |
# File 'lib/taglish/taggable.rb', line 5 def taggable? false end |
#taglish ⇒ Object
9 10 11 |
# File 'lib/taglish/taggable.rb', line 9 def taglish taglish_on(:tags) end |
#taglish_on(*tag_types) ⇒ Object
Make a model taggable on specified contexts.
Example:
class User < ActiveRecord::Base
taglish_on :languages, :skills
end
43 44 45 |
# File 'lib/taglish/taggable.rb', line 43 def taglish_on(*tag_types) taggable_on(false, false, tag_types) end |