Giter Site home page Giter Site logo

Comments (3)

spikebrehm avatar spikebrehm commented on June 1, 2024

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.

grudelsud avatar grudelsud commented on June 1, 2024

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.

EvanCarroll avatar EvanCarroll commented on June 1, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.