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

Adam Ruf
Adam Ruf
10,638 Points

Help: undefined method `name' for #<Status:0x000001026a8800>

After going along smoothly through all previous steps, I'm getting an undefined method `name' error after completing the Creating an Authentication System.

Even after going back through the videos for that section, I didn't see any place where I strayed from the path that was presented.

Currently, when I run the app locally, I can only access the index page (where none of my previous status messages are displayed) and the /users/sign_up page, but not the /statuses/new page.

Has anyone else run into this issue? How did you resolve it?

Thanks!

8 Answers

Adam Ruf
Adam Ruf
10,638 Points

Thanks, Jason & Devon!

When I saw that I'd broke the page, I assumed that I'd done something incorrectly and I didn't think there was any point in continuing until I'd fixed my mistake.

It would be nice if there was a head's up that told you to expect broken code and to keep watching. :-)

I'm glad to be back on track!

Will Robert
Will Robert
905 Points

Well, I'm glad someone else posted this, I thought I had a typo somewhere.

I just ran into the same issue while following along in the "Getting the Latest Changes Video". It shows the same "Undefined method'name'..." error. Maybe it's because in the "add_user_id_to_statuses" migrate we deleted the "name" column from our statuses db:

remove_column :statuses, :name

In the "_form" partial, it assigns a value to the "name" column (I think):

<div class="field">
<%= f.label :name %><br />
<%= f.text_field :name %> #assigning a value to non-existant :name column
  </div>

In the "show" view, it calls the name column again:

<p>
<b>Name:</b>
<%= @status.name %>
</p>

If I replace every "name" with a column that still exists, like "user_id", then I can get the pages to show up. That can't be right though. Did I miss something?

Yep, it helps to watch the video :)

Geoffrey McCaleb
PLUS
Geoffrey McCaleb
Courses Plus Student 578 Points

Just to echo previous comments, I think the "getting the latest changes" video should be altered or prefaced since the first 6 minutes or so are a bit confusing:

  • Jim shows making a status post. But as we removed "name" in the previous video we can't post one ourselves. Gives the viewer the impression they goofed somewhere
  • Jim also removes the name element and replaces it with a text entry of "Name" to show his existing statuses have been updated (and the page can load). Again in the previous video, we were prompted to remove our old statuses so this is a step we can't do
  • Signup: We go through the signup process again but we've already done this.

Minor quibbles, but it might be helpful to take a look at tweaking this video to avoid confusion...

jadaml
jadaml
11,593 Points

I'm running into that same issue with the full_name problem:

undefined method `full_name' for nil:NilClass

You say that as you go along it gets fixed so not to worry about it? I have passed the whole Customizing Forms section... keep going and it gets fixed or have I gone too far now for it still to be broken???

I have watched the videos in that section multiple times now and still am having that problem.

the problem is saying to be located in my index.html.erb file on line #9:

<strong><%= status.user.full_name %></strong>

I am receiving the same error, the video is very misleading. But it is also a cool problem to look into.