diff options
author | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2013-12-17 16:56:32 +0200 |
---|---|---|
committer | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2013-12-17 19:26:31 +0200 |
commit | 3c15f14e03134047ee92bdd51cfaf84d72188ef0 (patch) | |
tree | 3e8c8461518fe6791b1aa1b8238aa4f1a70c02d4 /acf2/model/model.lua | |
parent | 68ce109cc1609b7277a1afebcdee1cd424d8e9a9 (diff) | |
download | aconf-3c15f14e03134047ee92bdd51cfaf84d72188ef0.tar.bz2 aconf-3c15f14e03134047ee92bdd51cfaf84d72188ef0.tar.xz |
model: validate also computed fields
Diffstat (limited to 'acf2/model/model.lua')
-rw-r--r-- | acf2/model/model.lua | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/acf2/model/model.lua b/acf2/model/model.lua index 04d031a..7d026da 100644 --- a/acf2/model/model.lua +++ b/acf2/model/model.lua @@ -142,10 +142,7 @@ function M.Model:init(context) local v = mt.class[k] if isinstance(v, Field) then - v = BoundMember(self, k, v) - local res = v:load(options) - if res == nil and v.compute then return v:compute() end - return res + return BoundMember(self, k, v):load(options) end assert(mt.txn) @@ -204,7 +201,7 @@ function M.Model:init(context) function mt.validate() for _, f in ipairs(_members(Field)) do - if f.editable and not f.compute then + if f.editable then if mt.match(f.condition or {}) then f:validate_saved() else f:_save() end end |