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

Ruby ActiveRecord Basics Introduction to ActiveRecord A Quick and Dirty Example

Roy Huang
Roy Huang
4,367 Points

Uninitialized constant Post

Hello I was taking the course and trying to build a simple blog. It was fine to do

Post.create(title: "....", body: "....") in IRB

However, the second time I would like to make more posts for test as in the video, it told me "NameError: uninitialized constant Post"

I have done everything the video told me to, could someone tell me why does this happen?

Thanks in advance.

What is the output in the console look like?

1 Answer

That error is telling you that you have no model called Post. Ensure you have not mistyped the name of the model, or even named it 'Posts' or 'posts'.