Take the 2008 Git User's Survey and help out! [ hide ]

public
Description: This contains various plugins for Feather
Clone URL: git://github.com/eldiablo/feather-plugins.git
Search Repo:
Click here to lend your support to: feather-plugins and make a donation at www.pledgie.com !
whoisjake (author)
Sat May 10 14:38:11 -0700 2008
commit  32044e0cf46643fb3bbaddc4539c460f72df8a28
tree    6b2fb5aa28b4105fc9657dc7819e26eaf31d0413
parent  8a23772d42e56d48cd849354e4f03bf3514c05f8
100644 19 lines (16 sloc) 0.399 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class Tag < DataMapper::Base
  property :name, :string
  property :permalink, :string
  has_and_belongs_to_many :taggings
 
  before_create do |tag|
    tag.permalink = tag.name.downcase.gsub(/[^a-z0-9]+/i, '-')
  end
 
  ##
  # Has many through would be nice here
  def articles
    Article.all(:id => taggings.map{|t| t.article_id }, :published => true)
  end
 
  def to_param
    permalink
  end
end