frozen_record 0.27.3 → 0.27.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/frozen_record/base.rb +15 -11
- data/lib/frozen_record/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d790a4c35575afe0294cdcaa88f0f75bdee110623f40bfddd1ea4edade4df7c0
|
4
|
+
data.tar.gz: 0c5e6cd922365269c4a320a92c7b196749ce2016f5a8bdeb887bdc191a83ebcf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af254fb45c82cd57300fd613b513f1e423f102dc9dd3ddc5a2c99f0abd4b44cbd72b104b471795c8e1b9e91cda27d27760eea30fde2c682caef91b5ef1cc30e9
|
7
|
+
data.tar.gz: db4fd7fc5e5d5f00566a246b29ba8c0f337bfbf7043b6925ce7492ac7862372f4098c85f341b6b01672de47345055b10a9269f691fb2d9f0ee0623d2d8425799
|
data/CHANGELOG.md
CHANGED
data/lib/frozen_record/base.rb
CHANGED
@@ -28,17 +28,13 @@ module FrozenRecord
|
|
28
28
|
FIND_BY_PATTERN = /\Afind_by_(\w+)(!?)/
|
29
29
|
FALSY_VALUES = [false, nil, 0, -''].to_set
|
30
30
|
|
31
|
-
class_attribute :base_path, :
|
31
|
+
class_attribute :base_path, :_primary_key, :backend, :auto_reloading, :_default_attributes, instance_accessor: false
|
32
32
|
class_attribute :index_definitions, instance_accessor: false
|
33
33
|
class_attribute :attribute_deserializers, instance_accessor: false
|
34
34
|
class_attribute :max_records_scan, instance_accessor: false
|
35
35
|
self.index_definitions = {}.freeze
|
36
36
|
self.attribute_deserializers = {}.freeze
|
37
37
|
|
38
|
-
self.primary_key = 'id'
|
39
|
-
|
40
|
-
self.backend = FrozenRecord::Backends::Yaml
|
41
|
-
|
42
38
|
attribute_method_suffix '?'
|
43
39
|
|
44
40
|
class ThreadSafeStorage
|
@@ -68,16 +64,20 @@ module FrozenRecord
|
|
68
64
|
self.max_records_scan = previous_max_records_scan
|
69
65
|
end
|
70
66
|
|
71
|
-
|
72
|
-
|
67
|
+
def default_attributes
|
68
|
+
_default_attributes
|
69
|
+
end
|
70
|
+
|
73
71
|
def default_attributes=(default_attributes)
|
74
|
-
|
72
|
+
self._default_attributes = default_attributes.transform_keys(&:to_s)
|
73
|
+
end
|
74
|
+
|
75
|
+
def primary_key
|
76
|
+
_primary_key
|
75
77
|
end
|
76
78
|
|
77
|
-
alias_method :set_primary_key, :primary_key=
|
78
|
-
private :set_primary_key
|
79
79
|
def primary_key=(primary_key)
|
80
|
-
|
80
|
+
self._primary_key = -primary_key.to_s
|
81
81
|
end
|
82
82
|
|
83
83
|
attr_accessor :abstract_class
|
@@ -274,6 +274,10 @@ module FrozenRecord
|
|
274
274
|
|
275
275
|
end
|
276
276
|
|
277
|
+
self.primary_key = 'id'
|
278
|
+
|
279
|
+
self.backend = FrozenRecord::Backends::Yaml
|
280
|
+
|
277
281
|
def initialize(attrs = {})
|
278
282
|
@attributes = attrs.freeze
|
279
283
|
end
|