wulffeld_slug 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.12
1
+ 0.0.13
@@ -20,7 +20,15 @@ module WulffeldSlug
20
20
 
21
21
  # Can override this.
22
22
  def slug_unique?(slug)
23
- !self.class.where(:slug => slug).first
23
+ if new_record?
24
+ !self.class.where(:slug => slug).first
25
+ else
26
+ if self.slug_config[:mongo]
27
+ !self.class.where(:slug => slug).and(:_id.ne => self.id).first
28
+ else
29
+ !self.class.where(["slug = ? AND id <> ?", slug, self.id]).first
30
+ end
31
+ end
24
32
  end
25
33
 
26
34
  def cb_make_slug
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{wulffeld_slug}
8
- s.version = "0.0.12"
8
+ s.version = "0.0.13"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{Martin Moen Wulffeld}]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wulffeld_slug
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 5
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 12
10
- version: 0.0.12
9
+ - 13
10
+ version: 0.0.13
11
11
  platform: ruby
12
12
  authors:
13
13
  - Martin Moen Wulffeld