fixture_farm 0.1.5 → 0.1.6

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: 9120ab7f693c781ea48772f5b4f9d277165771afc073f6ed466c88a5fdea2455
4
- data.tar.gz: 50b502cab64010626ea929ecf3702b51c4211b98db14a013adb1194c687073a5
3
+ metadata.gz: c681a08bddfef41bec83f8fc4693fc299f5b0f750d1904a652d2adac306aad51
4
+ data.tar.gz: b1a19637eab90fe234dc45eba360963a5342b1923f7085d75a19df4678829669
5
5
  SHA512:
6
- metadata.gz: 17eadbd5c25eb70dd41dec53f0727890bb7674ddb25bb349eca51e646e8a81f822b8736fe9e6e5ffb9e5cd7b19f7677b92e574c694dc35814d79f0441c22d6bb
7
- data.tar.gz: 4403bf7831042e7abce331e3076242cf97c9916ddef4457c08322e956f0a79f9606ed1fd9f348876988741ab277461e15484577698a74d4732d2d0acd8a3a13f
6
+ metadata.gz: 194b052b53935e3e74c7f16818b83f8536c836ac09d3911a966f50591b0931348d75a4448fafcfaa657295855c016902df0bed068a798e90ff478d841f0a5427
7
+ data.tar.gz: d1da130e48e0fa0802edb690600482b897985fa8928be6189b5c13c3b74401df67d5963e9c183387e6dd309826e1fc20b989b7b8c4348ec3cf0394b3e9beb075
@@ -115,6 +115,8 @@ module FixtureFarm
115
115
  if belongs_to_association
116
116
  associated_model_instance = find_assiciated_model_instance(model_instance, belongs_to_association)
117
117
 
118
+ next unless associated_model_instance
119
+
118
120
  associated_fixture_name = named_new_fixtures.find do |_, fixture_model|
119
121
  fixture_model.id == associated_model_instance.id
120
122
  end&.first || associated_model_instance.fixture_name
@@ -154,6 +156,11 @@ module FixtureFarm
154
156
 
155
157
  id = model_instance.public_send(association.foreign_key)
156
158
  associated_model_class.unscoped.find(id)
159
+ rescue ActiveRecord::RecordNotFound
160
+ # In case of `belongs_to optional: true`, the associated record
161
+ # may have already been deleted by the time we record fixtures.
162
+ # We don't want to fail in this case.
163
+ nil
157
164
  end
158
165
 
159
166
  def serialize_attributes(value)
@@ -1,3 +1,3 @@
1
1
  module FixtureFarm
2
- VERSION = '0.1.5'
2
+ VERSION = '0.1.6'
3
3
  end
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.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - artemave
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-09 00:00:00.000000000 Z
11
+ date: 2024-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -24,7 +24,7 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '6.2'
27
- description:
27
+ description:
28
28
  email:
29
29
  - mr@artem.rocks
30
30
  executables:
@@ -52,7 +52,7 @@ licenses:
52
52
  metadata:
53
53
  homepage_uri: https://github.com/featurist/fixture_farm
54
54
  source_code_uri: https://github.com/featurist/fixture_farm.git
55
- post_install_message:
55
+ post_install_message:
56
56
  rdoc_options: []
57
57
  require_paths:
58
58
  - lib
@@ -67,8 +67,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  requirements: []
70
- rubygems_version: 3.1.6
71
- signing_key:
70
+ rubygems_version: 3.4.10
71
+ signing_key:
72
72
  specification_version: 4
73
73
  summary: Generate rails fixutures while browsing
74
74
  test_files: []