scoped_id 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e98b2cafc0f93b81f6b9872ce8c01a1f9a51c5be
4
- data.tar.gz: e0f6d16fa4c5532d6b1588ba4ad535015d5ea205
3
+ metadata.gz: 341ade7aa5eaece8112291f01cf84cb7ffeb3aa6
4
+ data.tar.gz: 5cdf5413543f21074f48ef2dc17b2ae8f9c96cbf
5
5
  SHA512:
6
- metadata.gz: 3f6ca0dea90dfabfd778f40ed6615153f438f4672c70093fbdfa7b3271c664ed0c4686381eeac686775eeebca94683564a367ba65fcf45440b2b7d396107e800
7
- data.tar.gz: b633b35869cdf8b33d0ea87063053c208fe4a6c2ce6d80449b4ab80a8dfe20f7199bbd6071a335d334e211e2ff43ab3386c7ed6221e23dce4fa04592d5de4dba
6
+ metadata.gz: 25daa76534e3b5b470ed1582d6abf2e900123bdbe53b877d44d8c71fe375ad10fdc04947dc1d63bde3cf6a000820a56fc4c41b4ec2f11c9a46316b881e520153
7
+ data.tar.gz: ce54f624893cb92f880ebc318415943f7bc8b846d74b5e106d0a14bde002cbb9e11dd59f03aee6d5f04b52cb13ec25dd71f22e8870bca697e1a919d1e8c5ed3f
data/README.md CHANGED
@@ -6,7 +6,7 @@ Generates scoped unique identifiers.
6
6
 
7
7
  Add `scoped_id` to your Gemfile:
8
8
 
9
- gem 'scoped_id', '~> 0.0.1'
9
+ gem 'scoped_id', '~> 0.0.2'
10
10
 
11
11
  ## Usage
12
12
 
@@ -23,7 +23,7 @@ module ScopedId
23
23
 
24
24
  attr_readonly attr_name
25
25
 
26
- validates_uniqueness_of attr_name, scope: scope
26
+ validates_uniqueness_of attr_name, scope: scope, allow_nil: true
27
27
  end
28
28
 
29
29
  def scoped_ids_definitions
@@ -1,3 +1,3 @@
1
1
  module ScopedId
2
- VERSION = '0.0.1'.freeze
2
+ VERSION = '0.0.2'.freeze
3
3
  end
@@ -59,6 +59,11 @@ describe ScopedId do
59
59
  model.valid?.should be_true
60
60
  end
61
61
 
62
+ it "is valid if a record exists with a nil scoped id" do
63
+ BaseModel.create # owner_scoped_id == nil
64
+ Model.new.valid?.should be_true
65
+ end
66
+
62
67
  it "raises an exception if scope is not specified" do
63
68
  expect{
64
69
  Class.new(BaseModel) do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scoped_id
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michel Billard