devise_couch_potato 0.0.1 → 0.0.2

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{devise_couch_potato}
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Andi Bade"]
@@ -11,7 +11,8 @@ module Devise
11
11
  if self.respond_to?("by_#{attrib}")
12
12
  validate "uniqueness_of_#{attrib}".to_sym
13
13
  define_method "uniqueness_of_#{attrib}" do
14
- unless self.class.find(:conditions => { attrib => self.send(attrib) }).nil?
14
+ same = self.class.find(:conditions => { attrib => self.send(attrib) })
15
+ if same && same.id != self.id
15
16
  self.errors.add(attrib, options[:message] || :taken)
16
17
  end
17
18
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 1
9
- version: 0.0.1
8
+ - 2
9
+ version: 0.0.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Andi Bade