acts_as_identifier 1.1.1 → 1.1.2

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
  SHA256:
3
- metadata.gz: 445be323d571181bfd5130ec7b4551f459a2d42ae59f382f3548e06d9fbb996c
4
- data.tar.gz: a53b03f119d4fe291a8bae5129dbcf685cc19828b34967e9c366d870d8992ffa
3
+ metadata.gz: 1d0ef5e8642b9ffa1aaf5dfa6e73a6d3b76885d08c90c8d6b74799c650b9ad86
4
+ data.tar.gz: 6637b7954d14b63f122ba48ba168fcdd6c8963e85188336d113b3d9c94c34a54
5
5
  SHA512:
6
- metadata.gz: 72fab7b0cc1aff1c5556f1de26b4e3067d8a39cca603a4fdbb2150f8995f1b4ce89100b284fa60db3b21fa3925dea99c9e4378ede5c266dd81e3628285b7aa5b
7
- data.tar.gz: ff02f71aa8728bbf76972d2c84a76e064b2b44930ba2734f62efb3ed841bc09c29b1b4406cbad93daaa6057d4344761f3b8881a8d5da992857393597cd06484b
6
+ metadata.gz: 53908ce8a218741b7a2466f77e99b6fb80ef22460d4d920f43585038d92913a573dc9142c42d3e227e93c8771d869d0467b4a80cdb33ed207e9c0dee18e32a2b
7
+ data.tar.gz: 21eb32be02eb86a40a84a00691800f48cb80831904afa6606ede41c1c985cb03cee67b134d083611b7b557ada0ea7697dcc3f5b0e1ab6674e15d08792b860197
@@ -44,11 +44,13 @@ module ActsAsIdentifier
44
44
  "#{prefix}#{send("#{attr}_encoder").encode(num)}"
45
45
  end
46
46
 
47
- before_commit do |record|
48
- if record.previous_changes.key?(id_column.to_s) && !record.destroyed?
49
- record.update_column attr, self.class.send("encode_#{attr}", record.send(id_column))
47
+ define_method "update_#{attr}_before_commit" do
48
+ if previous_changes.key?(id_column.to_s) && !destroyed?
49
+ update_column attr, self.class.send("encode_#{attr}", send(id_column))
50
50
  end
51
51
  end
52
+
53
+ before_commit :"update_#{attr}_before_commit"
52
54
  end
53
55
  end
54
56
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActsAsIdentifier
4
- VERSION = '1.1.1'
4
+ VERSION = '1.1.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_identifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - xiaohui
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-04 00:00:00.000000000 Z
11
+ date: 2021-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xencoder
@@ -82,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  requirements: []
85
- rubygems_version: 3.0.8
85
+ rubygems_version: 3.0.9
86
86
  signing_key:
87
87
  specification_version: 4
88
88
  summary: Auto-generate unique identifier value for Active Record