diff options
-rw-r--r-- | acf/model/init.lua | 6 | ||||
-rw-r--r-- | acf/model/node.lua | 4 |
2 files changed, 6 insertions, 4 deletions
diff --git a/acf/model/init.lua b/acf/model/init.lua index 653464d..78f5032 100644 --- a/acf/model/init.lua +++ b/acf/model/init.lua @@ -85,9 +85,11 @@ function M.Reference:follow(context, value) return context.txn:fetch(pth.rawjoin(self:abs_scope(context), value)) end -function M.Reference:load(context) +function M.Reference:load(context, options) local ref = super(self, M.Reference):load(context) - return (context.txn and ref) and self:follow(context, ref) or ref + return ( + (not options or options.dereference ~= false) and context.txn and ref + ) and self:follow(context, ref) or ref end function M.Reference:_validate(context, value) diff --git a/acf/model/node.lua b/acf/model/node.lua index 5fa3a39..7be92cb 100644 --- a/acf/model/node.lua +++ b/acf/model/node.lua @@ -202,7 +202,7 @@ function M.List:init(context, params) if v == nil then local len = #mt.members() while k < len do - mt.save(k, mt.load(k + 1)) + mt.save(k, mt.load(k + 1, {dereference=false})) k = k + 1 end end @@ -212,7 +212,7 @@ function M.List:init(context, params) function mt.insert(v, i) local len = #mt.members() if not i then i = len + 1 end - for j = len,i,-1 do mt.save(j + 1, mt.load(j)) end + for j = len,i,-1 do mt.save(j + 1, mt.load(j, {dereference=false})) end mt.save(i, v) end end |