mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-26 14:03:28 -04:00
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
|
||||
|
||||
|
|
|
@ -266,6 +266,11 @@ class InternationalizationNode extends TreemaNode.nodeMap.object
|
|||
res = super(arguments...)
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue