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 +4 -4
- data/activerecord_cloneable.gemspec +1 -1
- data/lib/active_record/cloneable.rb +3 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36432cd9b690c17b693e79c605437529a4d722f4
|
4
|
+
data.tar.gz: d669176bee0e3bb84eaf7288b08675d878477d94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
|