fixture_farm 0.2.2 → 0.2.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/README.md +1 -0
- data/lib/fixture_farm/fixture_recorder.rb +4 -1
- data/lib/fixture_farm/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43aa39081579e57d7b594eac34c61e810e8729c607348510b96a40f4743edd38
|
4
|
+
data.tar.gz: 99ec6eeaac71cb939d6b730add5b4ccbe1cc886df2b6ab1922d10efa65a2de7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87815f5d50ff8ac43d89e48c04053b7559a9cfd0840179c95c28101a117fcba8fc4dba81ac674eaf4103126982a4b70b3e60abc913dbc7de7824acd6bd8b4cb6
|
7
|
+
data.tar.gz: 3de064aa07aa85980be1bd28a51b8e4dc43366722515c783b8f6f69613ab67cc1cd00c6fc81040d2bdb6c20af64969b557b1848de35b9d4142d80515097e717e
|
data/README.md
CHANGED
@@ -11,6 +11,7 @@ Generated fixture that `belongs_to` a record from an existing fixture, will refe
|
|
11
11
|
|
12
12
|
- doesn't update fixtures
|
13
13
|
- doesn't delete fixtures
|
14
|
+
- assumes that all serialized attributes are json (so that at least ActiveStorage::Blob metadata is correctly represented; it really should be Rails serializing attributes according to their respective coders when inserting fixtures into the database, but, alas, this isn't happening)
|
14
15
|
|
15
16
|
## Installation
|
16
17
|
|
@@ -177,13 +177,14 @@ module FixtureFarm
|
|
177
177
|
# This, in particular, turns off ActsAsTenant, that otherwise
|
178
178
|
# might return no record if the tenant has changed by this point.
|
179
179
|
def find_associated_model_instance(model_instance, association)
|
180
|
+
id = model_instance.public_send(association.foreign_key) or return
|
181
|
+
|
180
182
|
associated_model_class = if association.polymorphic?
|
181
183
|
model_instance.public_send(association.foreign_type).safe_constantize
|
182
184
|
else
|
183
185
|
association.klass
|
184
186
|
end
|
185
187
|
|
186
|
-
id = model_instance.public_send(association.foreign_key)
|
187
188
|
associated_model_class.unscoped.find(id)
|
188
189
|
rescue ActiveRecord::RecordNotFound
|
189
190
|
# In case of `belongs_to optional: true`, the associated record
|
@@ -200,6 +201,8 @@ module FixtureFarm
|
|
200
201
|
value.iso8601
|
201
202
|
when BigDecimal
|
202
203
|
value.to_f
|
204
|
+
when Hash
|
205
|
+
value.to_json
|
203
206
|
else
|
204
207
|
value
|
205
208
|
end
|
data/lib/fixture_farm/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fixture_farm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- artemave
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-03-
|
11
|
+
date: 2025-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|