Trying to better get around mongoose stripping out empty i18n objects.
This commit is contained in:
parent
ee95e4e450
commit
7477633909
2 changed files with 6 additions and 1 deletions
app
|
@ -274,7 +274,7 @@ class CocoModel extends Backbone.Model
|
|||
schema ?= @schema() or {}
|
||||
addedI18N = false
|
||||
if schema.properties?.i18n and _.isPlainObject(data) and not data.i18n?
|
||||
data.i18n = {'-':'-'} # mongoose doesn't work with empty objects
|
||||
data.i18n = {'-':{'-':'-'}} # mongoose doesn't work with empty objects
|
||||
sum += 1
|
||||
addedI18N = true
|
||||
|
||||
|
|
|
@ -267,6 +267,11 @@ class InternationalizationNode extends TreemaNode.nodeMap.object
|
|||
res = (r for r in res when r[0] isnt '-')
|
||||
res
|
||||
|
||||
populateData: ->
|
||||
super()
|
||||
if Object.keys(@data).length is 0
|
||||
@data['-'] = {'-':'-'} # also to get around mongoose bug
|
||||
|
||||
getChildSchema: (key) ->
|
||||
#construct the child schema here
|
||||
|
||||
|
|
Reference in a new issue