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 trial

JavaScript Retrieving Entries from a Table

Anthony Candaele
seal-mask
.a{fill-rule:evenodd;}techdegree
Anthony Candaele
Full Stack JavaScript Techdegree Student 32,135 Points

article.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?

Steven Parker
Steven Parker
231,269 Points

Could you provide a link to a workspace snapshot?

5 Answers

Anthony Candaele
seal-mask
.a{fill-rule:evenodd;}techdegree
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
Steven Parker
231,269 Points

The 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.

Steven Parker
Steven Parker
231,269 Points

That's just the preview URL. To share the workspace itself, make a snapshot of your workspace and post the link to that here.

Hey Anthony, did you ever sort this out? I'm getting the exact same error.