duck_record 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/duck_record/base.rb +4 -0
- data/lib/duck_record/nested_attributes.rb +26 -1
- data/lib/duck_record/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06bf2457884cf16768ed22c8eab54c06cd03e59d
|
4
|
+
data.tar.gz: 2b9fdb3b1e20e91e52e2e553f061302f777d2885
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42bfba1df7380612fa22a300225f8e75e46e14bccc565c7c1e403105d7b6bba293376e32e08a6a74fd7c47a21120c5a86ef836eabde8a23bac818eb7b80817b1
|
7
|
+
data.tar.gz: '095d81f5ac4b851f3989f6bba870e0dd30cbf2c4542968183dc4e963fcc6a2162deb0956519ff9b9f1205acad6baa5fcb61f9de42db9de4f23d9935ead1ac449'
|
data/lib/duck_record/base.rb
CHANGED
@@ -363,6 +363,31 @@ module DuckRecord
|
|
363
363
|
end
|
364
364
|
end
|
365
365
|
|
366
|
+
# Marks this record to be destroyed as part of the parent's save transaction.
|
367
|
+
# This does _not_ actually destroy the record instantly, rather child record will be destroyed
|
368
|
+
# when <tt>parent.save</tt> is called.
|
369
|
+
#
|
370
|
+
# Only useful if the <tt>:autosave</tt> option on the parent is enabled for this associated model.
|
371
|
+
def mark_for_destruction
|
372
|
+
@marked_for_destruction = true
|
373
|
+
end
|
374
|
+
|
375
|
+
# Returns whether or not this record will be destroyed as part of the parent's save transaction.
|
376
|
+
#
|
377
|
+
# Only useful if the <tt>:autosave</tt> option on the parent is enabled for this associated model.
|
378
|
+
def marked_for_destruction?
|
379
|
+
@marked_for_destruction
|
380
|
+
end
|
381
|
+
|
382
|
+
# Returns ActiveRecord::AutosaveAssociation::marked_for_destruction? It's
|
383
|
+
# used in conjunction with fields_for to build a form element for the
|
384
|
+
# destruction of this association.
|
385
|
+
#
|
386
|
+
# See ActionView::Helpers::FormHelper::fields_for for more info.
|
387
|
+
def _destroy
|
388
|
+
marked_for_destruction?
|
389
|
+
end
|
390
|
+
|
366
391
|
private
|
367
392
|
|
368
393
|
# Attribute hash keys that should not be assigned as normal attributes.
|
@@ -447,7 +472,7 @@ module DuckRecord
|
|
447
472
|
check_record_limit!(options[:limit], attributes_collection)
|
448
473
|
|
449
474
|
if attributes_collection.is_a? Hash
|
450
|
-
attributes_collection =
|
475
|
+
attributes_collection = attributes_collection.values
|
451
476
|
end
|
452
477
|
|
453
478
|
association = association(association_name)
|
data/lib/duck_record/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: duck_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jasl
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|