better_record 0.11.4 → 0.11.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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87be3ec376e667eade78445c2f216bd623e854a0b964cd8584e91dc0c3147daf
|
4
|
+
data.tar.gz: dbdb4945a8dbcf3d98ca030c8b2e0310dc71a596c90289db79f17fc87b6bf33f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04bf71457cc94a8b17528c73abca67fb7c3b0a89c15969f97d61bc371cb824572248698bbe743ae392ae9a60db4b272b1d8c47202e1c4d1f7f8eac15a65e86cf
|
7
|
+
data.tar.gz: 65f90e4eba84826cbcb4066e5181862fe6b70330334a479b71d2c9cf7e9edef1182a1616e5bde9003fb9e2ab25997dda78baff1b900cc1a09b4077fda403164f
|
@@ -1,19 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'active_support/concern'
|
4
|
-
require 'active_support/number_helper'
|
5
4
|
|
6
5
|
module BetterRecord
|
7
6
|
module ModelConcerns
|
8
7
|
module HasProtectedPassword
|
9
8
|
extend ActiveSupport::Concern
|
10
9
|
|
11
|
-
included do
|
12
|
-
unless self.const_defined?(:NON_DUPABLE_KEYS)
|
13
|
-
NON_DUPABLE_KEYS = []
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
10
|
module ClassMethods
|
18
11
|
def has_protected_password(
|
19
12
|
password_field: :password,
|
@@ -22,12 +15,29 @@ module BetterRecord
|
|
22
15
|
**opts
|
23
16
|
)
|
24
17
|
# == Constants ============================================================
|
25
|
-
|
18
|
+
og_dup_arr = []
|
19
|
+
|
20
|
+
if (
|
21
|
+
self.const_defined?(:NON_DUPABLE_KEYS) &&
|
22
|
+
(
|
23
|
+
self.const_get(:NON_DUPABLE_KEYS).is_a?(Array) ||
|
24
|
+
self.const_belongs_to_parent?(:NON_DUPABLE_KEYS)
|
25
|
+
)
|
26
|
+
)
|
27
|
+
og_dup_arr = [*self.const_get(:NON_DUPABLE_KEYS)]
|
28
|
+
self.__send__ :remove_const, :NON_DUPABLE_KEYS unless self.const_belongs_to_parent?(:NON_DUPABLE_KEYS)
|
29
|
+
end
|
30
|
+
|
31
|
+
unless self.const_defined?(:NON_DUPABLE_KEYS)
|
32
|
+
self.__send__ :const_set, :NON_DUPABLE_KEYS, Set[]
|
33
|
+
end
|
34
|
+
|
35
|
+
self::NON_DUPABLE_KEYS.merge(%I[
|
26
36
|
#{password_field}
|
27
37
|
new_#{password_field}
|
28
38
|
new_#{password_field}_confirmation
|
29
39
|
clear_#{password_field}
|
30
|
-
]
|
40
|
+
])
|
31
41
|
|
32
42
|
# == Attributes ===========================================================
|
33
43
|
attribute :"new_#{password_field}", :text
|
data/lib/core_ext/object.rb
CHANGED
@@ -18,6 +18,16 @@ class Object
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
+
def self.const_belongs_to_parent?(sym)
|
22
|
+
(
|
23
|
+
self.superclass &&
|
24
|
+
self.superclass.const_defined?(sym) &&
|
25
|
+
(
|
26
|
+
self.superclass.const_get(sym) == self.const_get(sym)
|
27
|
+
)
|
28
|
+
)
|
29
|
+
end
|
30
|
+
|
21
31
|
def force_print_trace(msg = "CALLED TRACER METHOD")
|
22
32
|
begin
|
23
33
|
raise
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: better_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sampson Crowley
|
@@ -36,20 +36,20 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '1.
|
39
|
+
version: '1.1'
|
40
40
|
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 1.
|
42
|
+
version: 1.1.2
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - "~>"
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: '1.
|
49
|
+
version: '1.1'
|
50
50
|
- - ">="
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: 1.
|
52
|
+
version: 1.1.2
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: store_as_int
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|