diff options
author | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2013-11-15 23:16:36 +0200 |
---|---|---|
committer | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2013-11-15 23:17:12 +0200 |
commit | c1d578649beaa0a851756da5154f4c17c202a826 (patch) | |
tree | 8dcf39be974f3bbe7a0ac32889e00f70d055e1dd /acf2/model | |
parent | 571eaa0daeb6884936fbf126e44d763ce664474f (diff) | |
download | aconf-c1d578649beaa0a851756da5154f4c17c202a826.tar.bz2 aconf-c1d578649beaa0a851756da5154f4c17c202a826.tar.xz |
model: allow storing values for computed fields
Diffstat (limited to 'acf2/model')
-rw-r--r-- | acf2/model/model.lua | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/acf2/model/model.lua b/acf2/model/model.lua index 5b04001..46f0c4d 100644 --- a/acf2/model/model.lua +++ b/acf2/model/model.lua @@ -144,8 +144,9 @@ function M.Model:init(context) if isinstance(v, Field) then v = BoundMember(self, k, v) - if v.compute then return v:compute() end - return v:load{create=create} + local res = v:load{create=create} + if res == nil and v.compute then return v:compute() end + return res end assert(mt.txn) |