Class: Noah::Tags

Inherits:
Object
  • Object
show all
Defined in:
lib/noah/models/tags.rb

Class Method Summary collapse

Class Method Details

.all(options = {}) ⇒ Object



105
106
107
108
109
110
# File 'lib/noah/models/tags.rb', line 105

def self.all(options = {})
  tag_hash = Hash.new
  options.empty? ? tags=Tag.all.sort : tags=Tag.find(options).sort
  tags.each {|t| tag_hash["#{t.name}"] = t.to_hash.reject {|k,v| k == :name } }
  tag_hash
end

.tagged(tag) ⇒ Object



113
114
115
116
# File 'lib/noah/models/tags.rb', line 113

def tagged(tag)
  t = Tag.find(:name => tag).first
  t.members
end