mongoid_slug 1.0.0.rc1 → 1.0.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/mongoid/slug.rb CHANGED
@@ -57,7 +57,8 @@ module Mongoid
57
57
  self.history = options[:history]
58
58
 
59
59
  if slug_scope
60
- index({slug_scope: 1, _slugs: 1}, {unique: true})
60
+ scope_key = (metadata = self.reflect_on_association(slug_scope)) ? metadata.key : slug_scope
61
+ index({scope_key => 1, _slugs: 1}, {unique: true})
61
62
  else
62
63
  index({_slugs: 1}, {unique: true})
63
64
  end
@@ -1,5 +1,5 @@
1
1
  module Mongoid #:nodoc:
2
2
  module Slug
3
- VERSION = '1.0.0.rc1'
3
+ VERSION = '1.0.0.rc2'
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.rc1
4
+ version: 1.0.0.rc2
5
5
  prerelease: 6
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-09-14 00:00:00.000000000 Z
12
+ date: 2012-09-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mongoid