Module: Skyline::Taggable
- Defined in:
- lib/skyline/taggable.rb
Overview
Usage: class Model < ActiveRecord::Base
include Skyline::Taggable
end
1) Registers your model in the Skyline::Tag.taggable_models list
2) Gives your Model the following interface:
class Model < ActiveRecord::Base
has_many :associated_tags, :class_name => "Skyline::AssociatedTag", :as => "taggable"
has_many :tags, :through => :associated_tags, :class_name => "Skyline::Tag"
named_scope :with_tags (tags) (scope to return items that have at least one of the tags supplied; or all if no tags are passed)
def raw_tags
def raw_tags=(str)
def available_tags
end
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #available_tags ⇒ Object
- #clone_with_associated_tags ⇒ Object
- #raw_tags ⇒ Object
- #raw_tags=(str) ⇒ Object
Instance Method Details
#available_tags ⇒ Object
59 60 61 |
# File 'lib/skyline/taggable.rb', line 59 def self.class. end |
#clone_with_associated_tags ⇒ Object
63 64 65 66 67 |
# File 'lib/skyline/taggable.rb', line 63 def returning do |clone| clone. = self..collect{|at| at.clone } end end |
#raw_tags ⇒ Object
45 46 47 |
# File 'lib/skyline/taggable.rb', line 45 def self..collect{|t| t.tag}.join(" ") end |