Module: MongoMapperExt::Slugizer
- Defined in:
- lib/mongomapper_ext/slugizer.rb
Defined Under Namespace
Modules: ClassMethods, Finder
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.included(klass) ⇒ Object
3
4
5
6
7
8
9
10
|
# File 'lib/mongomapper_ext/slugizer.rb', line 3
def self.included(klass)
klass.class_eval do
extend ClassMethods
extend Finder
key :slug, String, :index => true
end
end
|
Instance Method Details
#to_param ⇒ Object
12
13
14
|
# File 'lib/mongomapper_ext/slugizer.rb', line 12
def to_param
self.slug.blank? ? self.id.to_s : self.slug
end
|