frozen_record 0.27.2 → 0.27.4
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 +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/frozen_record/base.rb +19 -24
- data/lib/frozen_record/version.rb +1 -1
- metadata +3 -3
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
@@ -1,5 +1,13 @@
|
|
1
1
|
# Unreleased
|
2
2
|
|
3
|
+
# v0.27.4
|
4
|
+
|
5
|
+
- Also fix compatibility with Rails 8.0.0alpha: https://github.com/rails/rails/pull/52717. Missed a few places.
|
6
|
+
|
7
|
+
# v0.27.3
|
8
|
+
|
9
|
+
- Fix compatibility with Rails 8.0.0alpha: https://github.com/rails/rails/pull/52717
|
10
|
+
|
3
11
|
# v0.27.2
|
4
12
|
|
5
13
|
- Fix a Ruby warning that was emitted when `frozen_record` is loaded.
|
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,23 +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)
|
75
73
|
end
|
76
74
|
|
77
|
-
|
78
|
-
|
79
|
-
def primary_key=(primary_key)
|
80
|
-
set_primary_key(-primary_key.to_s)
|
75
|
+
def primary_key
|
76
|
+
_primary_key
|
81
77
|
end
|
82
78
|
|
83
|
-
|
84
|
-
|
85
|
-
def base_path=(base_path)
|
86
|
-
@file_path = nil
|
87
|
-
set_base_path(base_path)
|
79
|
+
def primary_key=(primary_key)
|
80
|
+
self._primary_key = -primary_key.to_s
|
88
81
|
end
|
89
82
|
|
90
83
|
attr_accessor :abstract_class
|
@@ -115,13 +108,11 @@ module FrozenRecord
|
|
115
108
|
|
116
109
|
def file_path
|
117
110
|
raise ArgumentError, "You must define `#{name}.base_path`" unless base_path
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
file_path
|
124
|
-
end
|
111
|
+
file_path = File.join(base_path, backend.filename(name))
|
112
|
+
if !File.exist?(file_path) && File.exist?("#{file_path}.erb")
|
113
|
+
"#{file_path}.erb"
|
114
|
+
else
|
115
|
+
file_path
|
125
116
|
end
|
126
117
|
end
|
127
118
|
|
@@ -283,6 +274,10 @@ module FrozenRecord
|
|
283
274
|
|
284
275
|
end
|
285
276
|
|
277
|
+
self.primary_key = 'id'
|
278
|
+
|
279
|
+
self.backend = FrozenRecord::Backends::Yaml
|
280
|
+
|
286
281
|
def initialize(attrs = {})
|
287
282
|
@attributes = attrs.freeze
|
288
283
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: frozen_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.27.
|
4
|
+
version: 0.27.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean Boussier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
125
|
- !ruby/object:Gem::Version
|
126
126
|
version: '0'
|
127
127
|
requirements: []
|
128
|
-
rubygems_version: 3.5.
|
128
|
+
rubygems_version: 3.5.17
|
129
129
|
signing_key:
|
130
130
|
specification_version: 4
|
131
131
|
summary: ActiveRecord like interface to read only access and query static YAML files
|