uniq_identifier 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a6f678939241bfd79c27206043c3b38e5648f62e
4
- data.tar.gz: 72c0accd976c83691a8e334544248fb0e3ed62bc
3
+ metadata.gz: 5ad54b8fdbf78cc516447c0df9c3e72045633eb4
4
+ data.tar.gz: ff5326299c07784a10442e873b04410e98d0547e
5
5
  SHA512:
6
- metadata.gz: 295c8d6342cd8245aa181a6554bd2dc67423db8b47c063c9a3b9da3010de76be646665a770b0a521957ee1f80616a3c34ecea4d8a926fb9aa82468baa7e951ff
7
- data.tar.gz: 99e228f69121f1869745e48420111f3cef260d7a8b74d33d3e0f0c42a49fa1cd224958d13d669b71d41ca2b4eaa409a60ab3deaf6256a138b415ae43a4959fd3
6
+ metadata.gz: 0066a5862a514bd49bf5bab804c0a7ffc98fc3659e96165505ac171343f4c0d5c6725efa98cf39916f3904530c59c57755889f772008528b7d84aad66ce0cb8a
7
+ data.tar.gz: 5b07c603673eb742f4b3a2147d10ac4e9b55428241dcd2af11dda3d2d0b863c2534737c8279a59d6a9eb35813358f9d850c18d2009da823c930f96fc9b83fc95
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ### VERSION 0.0.5
2
+
3
+ * Enhancements
4
+ * decrease time of migration for big table
5
+ * change after initialize to before validation for avoid loading this hook each time we have an instance (iteration case)
6
+
1
7
  ### VERSION 0.0.4
2
8
 
3
9
  * Enhancements
data/README.md CHANGED
@@ -39,6 +39,8 @@ end
39
39
  ```ruby
40
40
  foo = Foo.new
41
41
  foo.id # => nil
42
+ foo.uuid # => nil
43
+ foo.valid?
42
44
  foo.uuid # => "0c6bbc03-a269-44e2-8075-f442e1aac0c8"
43
45
  ```
44
46
 
@@ -1,8 +1,9 @@
1
1
  class AddUuid<%= class_name %> < ActiveRecord::Migration
2
+ disable_ddl_transaction!
2
3
  def change
3
4
  change_table(:<%= plural_name %>) do |t|
4
- t.string :uuid
5
+ t.string :uuid, :string, limit: 40
5
6
  end
6
- add_index(:<%= plural_name %>, :uuid)
7
+ add_index(:<%= plural_name %>, :uuid, unique: true)
7
8
  end
8
9
  end
@@ -1,3 +1,3 @@
1
1
  module UniqIdentifier
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
@@ -8,7 +8,6 @@ module UniqIdentifier
8
8
 
9
9
  def uniq_identifier
10
10
  include Hook
11
- after_initialize :set_uniq_identifier
12
- after_validation :set_uniq_identifier # Case of manual attempt to do a nil assignation
11
+ before_validation :set_uniq_identifier
13
12
  end
14
13
  end
@@ -3,6 +3,10 @@ require 'spec_helper'
3
3
  describe UniqIdentifier do
4
4
  let(:user) { User.new }
5
5
 
6
+ before do
7
+ user.valid?
8
+ end
9
+
6
10
  specify do
7
11
  expect(user.uuid).to match(/(.*)-(.*)-(.*)-(.*)-(.*)/)
8
12
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uniq_identifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel AZEMAR