mm-sluggable 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/mm-sluggable.rb +5 -7
- metadata +4 -4
data/Rakefile
CHANGED
@@ -21,7 +21,7 @@ spec = Gem::Specification.new do |s|
|
|
21
21
|
|
22
22
|
# Change these as appropriate
|
23
23
|
s.name = "mm-sluggable"
|
24
|
-
s.version = "0.1.
|
24
|
+
s.version = "0.1.1"
|
25
25
|
s.summary = "Tiny plugin for MongoMapper to cache a slugged version of a field"
|
26
26
|
s.author = "Richard Livsey"
|
27
27
|
s.email = "richard@livsey.org"
|
data/lib/mm-sluggable.rb
CHANGED
@@ -9,7 +9,9 @@ module MongoMapper
|
|
9
9
|
|
10
10
|
module ClassMethods
|
11
11
|
def sluggable(to_slug = :title, options = {})
|
12
|
-
|
12
|
+
class_attribute :slug_options
|
13
|
+
|
14
|
+
self.slug_options = {
|
13
15
|
:to_slug => to_slug,
|
14
16
|
:key => :slug,
|
15
17
|
:index => true,
|
@@ -18,13 +20,9 @@ module MongoMapper
|
|
18
20
|
:callback => :before_validation_on_create
|
19
21
|
}.merge(options)
|
20
22
|
|
21
|
-
key
|
22
|
-
|
23
|
-
self.send(@slug_options[:callback], :set_slug)
|
24
|
-
end
|
23
|
+
key slug_options[:key], String, :index => slug_options[:index]
|
25
24
|
|
26
|
-
|
27
|
-
attr_reader :slug_options
|
25
|
+
self.send(slug_options[:callback], :set_slug)
|
28
26
|
end
|
29
27
|
end
|
30
28
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mm-sluggable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Richard Livsey
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-03-01 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|