Skip to content

Commit

Permalink
FIX #70: Warning if attempt to save beofre app init, and fix type error.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackson Gariety committed Mar 3, 2014
1 parent 6d9d03c commit f8f0979
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions examples/mustache-example/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ App.storage('todolist', require('../../lib/adapters/mongodb'))
'/': TodoView.render
, '/about': AboutView.render
})
.init({ env: 'development' }, function () {
})
.init({ env: 'development' })
6 changes: 3 additions & 3 deletions lib/sara.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,12 @@ Sara.prototype.init = function (options, fn) {
_(this).extend(options)
if (IS_SERVER) {
this.root = _.filepathFromStackIndex(2)
setupServer(this)
} else if (IS_CLIENT) setupClient(this, callback)
setupServer(this, callback.bind(this))
} else if (IS_CLIENT) setupClient(this, callback.bind(this))

function callback() {
this.initialized = true
if (fn instanceof Function) fn.bind(this)()
if (fn instanceof Function && IS_CLIENT) fn.bind(this)()
}

return this
Expand Down
2 changes: 1 addition & 1 deletion lib/sara/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ function Model(name, schema, initialize) {
})
}
}.bind(this))
}
} else console.warn('Attempted to save model before app initialization.')
return this
}

Expand Down

0 comments on commit f8f0979

Please sign in to comment.