Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAnthony Candaele
Full Stack JavaScript Techdegree Student 32,135 Pointsarticle.publishedAt is not a function
When I want to list all articles I get this error:
article.publishedAt() article.publishedAt is not a function TypeError: /Users/acandael/Tutorials/javascript-tech-degree/sequelize_blog/views/articles/by_line.jade:4 2| = article.author 3| | |
4| = article.publishedAt()
I double checked the code in the models file, but I can't find any typos: .... instanceMethods: { publishedAt: function() { return dateFormat(this.createdAt, 'dddd, mmmm dS, yyyy, h:MM TT'); }, shortDescription: function() { return this.body.length > 30 ? this.body.substr(0, 30) + '...' : this.body; } }
Anyone else got this error?
5 Answers
Anthony Candaele
Full Stack JavaScript Techdegree Student 32,135 Points@Steven I pushed my code to github:
https://github.com/acandael/sequelize-blog
the error I get is:
TypeError: /Users/acandael/Tutorials/javascript-tech-degree/sequelize_blog/views/articles/by_line.jade:4
thanks for your help!
greetings,
Anthony
Steven Parker
231,269 PointsThe repo is good for just sharing the code, but a workspace allows you to share the complete environment which makes it easy to replicate the issue. Otherwise, someone must first try to reproduce the build environment, which might be a significant task if they are not already working with the same project or one that uses all the same libraries.
Anthony Candaele
Full Stack JavaScript Techdegree Student 32,135 PointsI recreated the code in a workspace and I'm getting the same error. My workspace is at:
http://port-3000-3ixwtgt1cm.treehouse-app.com/articles
greetings,
Anthony
Steven Parker
231,269 PointsThat's just the preview URL. To share the workspace itself, make a snapshot of your workspace and post the link to that here.
Anthony Candaele
Full Stack JavaScript Techdegree Student 32,135 Pointsthe link of my snapshot is:
Michael Chambers
Full Stack JavaScript Techdegree Graduate 28,393 PointsHey Anthony, did you ever sort this out? I'm getting the exact same error.
Truman Smith
Full Stack JavaScript Techdegree Graduate 17,901 PointsI'm getting a similar error. Here is a snapshot of my workspace. https://w.trhou.se/mjf1wsjw43
Truman Smith
Full Stack JavaScript Techdegree Graduate 17,901 PointsI've found an answer at https://teamtreehouse.com/community/es6-question, as suggested by Lee V.
Steven Parker
231,269 PointsSteven Parker
231,269 PointsCould you provide a link to a workspace snapshot?