GithubHelp home page GithubHelp logo

jade tasks about express-example HOT 5 CLOSED

sequelize avatar sequelize commented on April 27, 2024
jade tasks

from express-example.

Comments (5)

micahlisonbee avatar micahlisonbee commented on April 27, 2024

Same issue here. I'm new to Node and Sequelize is the first ORM I'm choosing to test out but it's making it extremely difficult to get up and running with this error. (Using ExpressJS as well).

from express-example.

sdepold avatar sdepold commented on April 27, 2024

will check this!

from express-example.

siraleem avatar siraleem commented on April 27, 2024

Same here

Express
500 TypeError: e:\Aleem Practice\sequelize-expressjs-example-master\views\index.jade:24
22| input(type="text", name="title")
23| input(type="submit")
> 24| each task in user.tasks
25| li
26| = task.title
27| |

Cannot read property 'length' of undefined

22| input(type="text", name="title")
23| input(type="submit")
> 24| each task in user.tasks
25| li
26| = task.title
27| |  
Cannot read property 'length' of undefined
at $l (eval at (e:\Aleem Practice\sequelize-expressjs-example-master\node_modules\jade\lib\jade.js:179:8), :129:31)
at eval (eval at (e:\Aleem Practice\sequelize-expressjs-example-master\node_modules\jade\lib\jade.js:179:8), :204:4)
at eval (eval at (e:\Aleem Practice\sequelize-expressjs-example-master\node_modules\jade\lib\jade.js:179:8), :344:4)
at eval (eval at (e:\Aleem Practice\sequelize-expressjs-example-master\node_modules\jade\lib\jade.js:179:8), :354:22)
at res (e:\Aleem Practice\sequelize-expressjs-example-master\node_modules\jade\lib\jade.js:180:38)
at Object.exports.render (e:\Aleem Practice\sequelize-expressjs-example-master\node_modules\jade\lib\jade.js:305:10)
at Object.exports.renderFile (e:\Aleem Practice\sequelize-expressjs-example-master\node_modules\jade\lib\jade.js:341:18)
at View.exports.renderFile [as engine] (e:\Aleem Practice\sequelize-expressjs-example-master\node_modules\jade\lib\jade.js:326:21)
at View.render (e:\Aleem Practice\sequelize-expressjs-example-master\node_modules\express\lib\view.js:76:8)
at Function.app.render (e:\Aleem Practice\sequelize-expressjs-example-master\node_modules\express\lib\application.js:504:10)

from express-example.

salsaysal avatar salsaysal commented on April 27, 2024

I just solved it!!!

1.In the file /models/users.js there's a line that starts with 'User.hasMany'. Change it so that it reads:
User.hasMany(models.Task, {as:'tasks'});
2.In the file /routes/index.js there's a line that starts with 'include'. Change it so that it reads:
include: [ {model: db.Task, as: 'tasks'} ]

Note: I'm using postgreSQL (the code is thought for mysql, however I'd bet this fact is not related with this issue)

from express-example.

sdepold avatar sdepold commented on April 27, 2024

The actual problem was that the code used user.tasks whereas it has to be user.Tasks. Though I wonder if that has always been the case.

from express-example.

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.