mongoid_slug 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mongoid/slug.rb +7 -5
- data/lib/mongoid/slug/version.rb +1 -1
- metadata +2 -2
data/lib/mongoid/slug.rb
CHANGED
@@ -56,11 +56,13 @@ module Mongoid
|
|
56
56
|
self.slugged_attributes = fields.map &:to_s
|
57
57
|
self.history = options[:history]
|
58
58
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
59
|
+
unless embedded?
|
60
|
+
if slug_scope
|
61
|
+
scope_key = (metadata = self.reflect_on_association(slug_scope)) ? metadata.key : slug_scope
|
62
|
+
index({scope_key => 1, _slugs: 1}, {unique: true})
|
63
|
+
else
|
64
|
+
index({_slugs: 1}, {unique: true})
|
65
|
+
end
|
64
66
|
end
|
65
67
|
|
66
68
|
#-- Why is it necessary to customize the slug builder?
|
data/lib/mongoid/slug/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid_slug
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mongoid
|