photomix/app/models/tag.rb

15 lines
332 B
Ruby
Raw Normal View History

2009-05-22 22:38:52 +02:00
class Tag < ActiveRecord::Base
has_many :photo_tags
has_many :photos, :through => :photo_tags
2009-05-25 21:39:43 +02:00
validates_uniqueness_of :title
def to_param
#{ }"#{id}-#{name.gsub(/[^a-z0-9]+/i, '-')}"
#id.to_s+'-'+name.downcase.gsub(/[^a-z0-9]+/i, '-')
#id.to_s+'-'+name.downcase.gsub(' ', '-')
self.title
end
2009-05-22 22:38:52 +02:00
end