deep_unrest 0.1.14 → 0.1.15

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f6373c8bffc0e5343d0a7dfd2597b8a626dc0090
4
- data.tar.gz: 051046bfa0f54fce20c5f77e8b8ed5c4ae2326fe
3
+ metadata.gz: 6399b9cf607bb71db3f29983c64bc875e51ad88a
4
+ data.tar.gz: 43ba25e40fa2e101623686090c4a7969bab2e372
5
5
  SHA512:
6
- metadata.gz: 1463975f553a56c5eacf384642d2a89fe2e5525efd0fe0054834601d7b0790dce399396ef41701e5f46d7e72b71ab0fc70f571743f8a9eb4390f3801df07a676
7
- data.tar.gz: aa71277e735edc51753ebea6047c375c9b4cf34f43df818ca4a75867d4ead2e812aba5f019ba8a3433000ed5cfa73534774988ddc4d23a874d3540356cabca95
6
+ metadata.gz: e6ed340e24a1949b13c2690ca40bffc0f6cdc1e96c6005e97c033c7b68bdeeaa086db38d5a6ea24a701a6f2e8c8098e45ed050a8002bae97925f03c41316cac9
7
+ data.tar.gz: dc3bd0f748165261d9431004e7a622069756b1de57ba35a18c111f57417dc451c66c3d416c1906742212e0ebcbe1dba5446ccfe1daa6073a140321460bf0466c
data/lib/deep_unrest.rb CHANGED
@@ -2,6 +2,23 @@
2
2
 
3
3
  require 'deep_unrest/engine'
4
4
 
5
+ # workaronud for rails bug with association indices.
6
+ # see https://github.com/rails/rails/pull/24728
7
+ module ActiveRecord
8
+ module AutosaveAssociation
9
+ # Returns the record for an association collection that should be validated
10
+ # or saved. If +autosave+ is +false+ only new records will be returned,
11
+ # unless the parent is/was a new record itself.
12
+ def associated_records_to_validate_or_save(association, new_record, autosave)
13
+ if new_record || autosave
14
+ association && association.target
15
+ else
16
+ association.target.find_all(&:new_record?)
17
+ end
18
+ end
19
+ end
20
+ end
21
+
5
22
  # Update deeply nested associations wholesale
6
23
  module DeepUnrest
7
24
  class InvalidParentScope < ::StandardError
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DeepUnrest
4
- VERSION = '0.1.14'
4
+ VERSION = '0.1.15'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deep_unrest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.14
4
+ version: 0.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lynn Hurley