better_record 0.9.1 → 0.9.3

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
  SHA256:
3
- metadata.gz: 52db9234b74d7353137d30bf090395940c5bb7fd34b4d49ffb88ea6fd6e58623
4
- data.tar.gz: aa433b5fb448d2d2fc6743295af6f9ce7bcb5c77044fc99f71da25cd2a35658b
3
+ metadata.gz: 89e2cc03ce6ebc207079aa90e895f6a5e1c1b4777a83b35d4242eb389c7f9fd9
4
+ data.tar.gz: d0d1a17deaa4cb0c210403e8371e8a1995bfb2ec3eebebca97976730ed78ec60
5
5
  SHA512:
6
- metadata.gz: 6b56ff1f17ac6e23cc96976eba2f88f5e1b80ad52fbe30de89776385b8914f76a9a6ad25e8636975e8b7153ae5debe53cb8d2c33472ef0355ff1b9c0230c7c1b
7
- data.tar.gz: 5261ea11af5df3e1c95174a3ecb83311818557e2b3b61b8791dabeb62cf2bc52751fae87fa0ede018a4b787204ba7299d2aeb946eca494a8b72d90f0ca984507
6
+ metadata.gz: 1ff141f8ea7ddd914fed69710f1408c7b5e9d5715db95ef8619d9f53306d4f111fda9392685c1669724ac2627bb2cc8a287e1d53399d43b930ae18fbee47286b
7
+ data.tar.gz: aa72daa57375b9301ee5d12675e1953dde08d39dcd7f7064e4208ecd540cf99614e0f2f67c3c18738beae18d4c56003ca19e27436bbbac2d62f728a79ada55ce
@@ -36,5 +36,12 @@ module BetterRecord
36
36
  attributes.with_indifferent_access
37
37
  end
38
38
 
39
+ def dup
40
+ if defined? NON_DUPABLE_KEYS
41
+ self.class.new(super.indifferent_attributes.except(*NON_DUPABLE_KEYS))
42
+ else
43
+ super
44
+ end
45
+ end
39
46
  end
40
47
  end
@@ -17,6 +17,15 @@ module BetterRecord
17
17
  **opts
18
18
  )
19
19
  # == Constants ============================================================
20
+ unless const_defined?(NON_DUPABLE_KEYS)
21
+ NON_DUPABLE_KEYS = []
22
+ end
23
+
24
+ NON_DUPABLE_KEYS |= %I[
25
+ #{password_field}
26
+ new_#{password_field}
27
+ new_#{password_field}_confirmation
28
+ ])
20
29
 
21
30
  # == Attributes ===========================================================
22
31
  attribute :"new_#{password_field}", :text
@@ -56,7 +56,7 @@ class CreateBetterRecordDBFunctions < ActiveRecord::Migration[5.2]
56
56
  $BODY$
57
57
  BEGIN
58
58
  IF email IS NOT NULL THEN
59
- IF email !~* '\\A[^@\\s\\;]+@[^@\\s\\;]+\\.[^@\\s\\;]+\\Z' THEN
59
+ IF email !~* '\\A[^@\\s;./[\\]\\\\]+(\\.[^@\\s;./[\\]\\\\]+)*@[^@\\s;./[\\]\\\\]+(\\.[^@\\s;./[\\]\\\\]+)*\\.[^@\\s;./[\\]\\\\]+\\Z' THEN
60
60
  RAISE EXCEPTION 'Invalid E-mail format %', email
61
61
  USING HINT = 'Please check your E-mail format.';
62
62
  END IF ;
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BetterRecord
4
- VERSION = '0.9.1'
4
+ VERSION = '0.9.3'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: better_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sampson Crowley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-28 00:00:00.000000000 Z
11
+ date: 2018-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails