activerecord_cloneable 0.3.5 → 0.3.6

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: 27cf2329d412714a2cb9cccba564b870e34af022
4
- data.tar.gz: 9a9009d8a1353ee9ae0a6ab2c0f344a9850dcd18
3
+ metadata.gz: 36432cd9b690c17b693e79c605437529a4d722f4
4
+ data.tar.gz: d669176bee0e3bb84eaf7288b08675d878477d94
5
5
  SHA512:
6
- metadata.gz: e42c32c05ab3371c6ab06720187ea19113d4449395aa6a2ec8c385467859e1ebbf39c0130229ec5f8bef21977a0c74d76854ff93296316e0b31a202f79f91eeb
7
- data.tar.gz: c840068eb59f07d60cf6886060e8bcd61cadce72487d810db0e5ca389dc2315b4e5a56995d4e34fb93593917ff054b1abae16d146ccfcd5fe39073df6d0f83af
6
+ metadata.gz: 18cb6bd86235774c433f2e432a050e42bcc58f42173d805e894ea7f03717951aa78d4b9d31a528a7f247ee7b107da70226e68c72028ae707d5e0353d2d4af633
7
+ data.tar.gz: 2ec1aaf0e47e40b1732fae3e9bcb71933245ed4f5b59983f8ce0d774aaf4e2faa1cf597fe9a7dbd84d3e08fb8cb7c7f211a62bc4fb32e0048d1b8a0c68a17c79
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'activerecord_cloneable'
3
- s.version = '0.3.5'
3
+ s.version = '0.3.6'
4
4
  s.summary = "A library to help clone active records - that is, generate active new record objects with the data copied from an existing record."
5
5
  s.authors = ["Adam Palmblad"]
6
6
  s.email = 'apalmblad@gmail.com'
@@ -119,6 +119,7 @@ module ActiveRecord::Cloneable
119
119
  attributes: {},
120
120
  stack: args[:stack] + [ child_relation.name ],
121
121
  object: cloned_child_record,
122
+ skipped_children: args[:skipped_children],
122
123
  skipped_parent_relations: find_applicable_clone_args( child_relation.name, args[:skipped_parent_relations] ),
123
124
  shared_parent_relations: find_applicable_clone_args( child_relation.name, args[:shared_parent_relations] ),
124
125
  skipped_child_relations: find_applicable_clone_args( child_relation.name, args[:skipped_child_relations] ) }
@@ -143,13 +144,14 @@ module ActiveRecord::Cloneable
143
144
  child_args = { cloned_parents: args[:cloned_parents] + [self],
144
145
  attributes: {},
145
146
  object: cloned_child_record,
147
+ skipped_children: args[:skipped_children],
146
148
  stack: args[:stack] + [ child_relation.name ] ,
147
149
  skipped_child_relations: args[:skipped_child_relations].find_all{ |x| x.is_a?( Hash ) && x[child_relation.name.to_sym] }.map{ |x| x.values }.flatten }
148
150
  begin
149
151
  cloned_child_record = kid.clone_record( child_args )
150
152
  cloned_record.send( "#{child_relation.name}=", cloned_child_record )
151
153
  rescue NoMethodError
152
- raise "#{kid.class.name} objects do not know how to clone themselves; they should be marked as cloneable or skipped. (#{self.class.name} / #{child_relation.name}"
154
+ raise "#{kid.class.name} objects do not know how to clone themselves; they should be marked as cloneable or skipped. (#{self.class.name} / #{child_relation.name} -- #{args[:stack].inspect}"
153
155
  end
154
156
  end
155
157
  return cloned_record
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord_cloneable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Palmblad