mongoid_slug 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
- if slug_scope
60
- scope_key = (metadata = self.reflect_on_association(slug_scope)) ? metadata.key : slug_scope
61
- index({scope_key => 1, _slugs: 1}, {unique: true})
62
- else
63
- index({_slugs: 1}, {unique: true})
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?
@@ -1,5 +1,5 @@
1
1
  module Mongoid #:nodoc:
2
2
  module Slug
3
- VERSION = '1.0.0'
3
+ VERSION = '1.0.1'
4
4
  end
5
5
  end
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.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-01 00:00:00.000000000 Z
12
+ date: 2012-10-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mongoid