mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
Added db formatter for settings model
refs #10582 - ensure we won't forward booleans to database - type TEXT will transform booleans to "0"/"1!
This commit is contained in:
parent
037ac4d748
commit
bfccaa8d2e
1 changed files with 11 additions and 0 deletions
|
@ -100,6 +100,17 @@ Settings = ghostBookshelf.Model.extend({
|
|||
});
|
||||
},
|
||||
|
||||
format() {
|
||||
const attrs = ghostBookshelf.Model.prototype.format.apply(this, arguments);
|
||||
|
||||
// @NOTE: type TEXT will transform boolean to "0"
|
||||
if (_.isBoolean(attrs.value)) {
|
||||
attrs.value = attrs.value.toString();
|
||||
}
|
||||
|
||||
return attrs;
|
||||
},
|
||||
|
||||
parse() {
|
||||
const attrs = ghostBookshelf.Model.prototype.parse.apply(this, arguments);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue