Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReferenceError: model User not registered, referred by model Article #124

Open
ramusus opened this issue Nov 12, 2014 · 3 comments
Open

Comments

@ramusus
Copy link

ramusus commented Nov 12, 2014

I'm trying to register default users from the project meanjs.org. But if Article has reference to User server fault with error:

ReferenceError: model `User` not registered, referred by model `Article`

I registered models by this snippet:

    require('formage').init(app, express, require(path.resolve('./app/models')), {
        title: 'Admin',
        root: '/admin',
        default_section: 'main',
        username: 'admin',
        password: 'admin',
        admin_users_gui: true
    });

And put ./app/models/index.js with:

'use strict';
module.exports.user = require('./user.server.model');
module.exports.article = require('./article.server.model');

Changing models order doesn't help.
Where I'm wrong?

@cwagner22
Copy link

same issue

@chaddy81
Copy link

Any fix or workarounds for this yet?

@dbachrach
Copy link

I just ran into this and the fix is to get the capitalization correct. You registered your mongo models as 'User' and 'Article', but when you exported them for formage in index.js you used lowercase 'user' and 'article'.

You should change it to:

'use strict';
module.exports.User = require('./user.server.model');
module.exports.Article = require('./article.server.model');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants