Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
221,451 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
221,451 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
221,451 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.