From e813f5b0ddf26758e02a693867ddc025197c3373 Mon Sep 17 00:00:00 2001 From: Kaarle Ritvanen Date: Wed, 11 Dec 2013 12:44:08 +0200 Subject: model: correct dereferencing behavior of reference sets take options.dereference into account --- acf2/model/init.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'acf2/model/init.lua') diff --git a/acf2/model/init.lua b/acf2/model/init.lua index 711626b..c9d95f9 100644 --- a/acf2/model/init.lua +++ b/acf2/model/init.lua @@ -55,7 +55,7 @@ local isinstance = object.isinstance local super = object.super local pth = require('acf2.path') -local update = require('acf2.util').update +local util = require('acf2.util') local stringy = require('stringy') @@ -105,7 +105,7 @@ function M.Reference:_choice(context) end end - else update(ch, {value=pth.escape(v), ['ui-value']=v}) end + else util.update(ch, {value=pth.escape(v), ['ui-value']=v}) end if ch then table.insert(res, ch) end end @@ -126,9 +126,9 @@ end function M.Reference:load(context, options) local ref = super(self, M.Reference):load(context) return ( - update( - options or {}, {dereference=self.dereference} - ).dereference and context.txn and ref + util.setdefault( + options or {}, 'dereference', self.dereference + ) and context.txn and ref ) and self:follow(context, ref) or ref end -- cgit v1.2.3