summaryrefslogtreecommitdiffstats
path: root/acf/model/node.lua
diff options
context:
space:
mode:
Diffstat (limited to 'acf/model/node.lua')
-rw-r--r--acf/model/node.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/acf/model/node.lua b/acf/model/node.lua
index afc3e0f..47a15c7 100644
--- a/acf/model/node.lua
+++ b/acf/model/node.lua
@@ -117,8 +117,11 @@ function Collection:init(context, params)
function mt.members() return mt.txn:get(mt.addr, 'table') or {} end
function mt.validate()
- if params.required and #mt.members() == 0 then
- raise(mt.path, 'Collection cannot be empty')
+ if #mt.members() > 0 then return end
+ if params.required then raise(mt.path, 'Collection cannot be empty') end
+ if params.destroy then
+ mt.txn:set(mt.addr)
+ validate(mt.parent)
end
end