Comments (3)
Hi, thanks for the issue report! Probably the issue is that you need to call the model super's initialize
method, because Rendr
utilizes initialize
to add some important functionality to BaseModel
: https://github.com/airbnb/rendr/blob/master/shared/base/model.js#L11
In your model, you could do something like this:
var BaseModel = require('rendr/shared/base/model');
module.exports = BaseModel.extend({
initialize: function() {
BaseModel.prototype.initialize.apply(this, arguments);
// your code here
}
});
module.exports.id = 'MyModelName';
Give that a try. But this brings up a good point that Rendr should endeavor to not hijack the model's initialize
method; instead we should just hijack the constructor. Will leave this open as a reminder to address that.
from rendr-app-template.
it works!
thank you very much man, really helpful. just so you know, I forked the rendr-app-template about a month ago and without any "super" initialization it worked just fine, the problem started after I synced with the latest updates yesterday, and now fixed calling the initialize function of the base model.
thank you again, closing this issue!
from rendr-app-template.
Where is this idiom of calling the BaseModel.prototype.initialize
documented? I've seen lots of examples where this is never done...
- Here is one example where that never happens in the docs, source
# app/models/user
BaseModel = require('rendr/base/model')
module.exports = class User extends BaseModel
url: '/users/:id'
from rendr-app-template.
Related Issues (20)
- grunt server fails on Windows 7 HOT 6
- Failed to install grunt-contrib-handlebars HOT 2
- ReferenceError: _ is not defined HOT 1
- __layout.hbs HOT 1
- does not run on Windows
- Template precompile HOT 3
- Injecting data coming from an asynchronous call into __layout.hbs HOT 5
- Some thoughts on the README HOT 1
- clientSync is used on a request when trying to create the server different from the index.js file HOT 2
- Handlebars precompiled versioning error HOT 1
- Broken links in README HOT 1
- apiProxy should handle status code 204 properly HOT 1
- Server side call
- Error on startup HOT 3
- Error: npm install rendr-app-template HOT 1
- Modularization of the site HOT 5
- npm install errors (ubuntu 12.04) HOT 3
- Need to add "npm install" step to README HOT 1
- Unable to start server in Windows 7 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rendr-app-template.