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

Andrew Lee
Andrew Lee
14,448 Points

NoMethodError in Statuses#new

Started GET "/statuses/new" for 127.0.0.1 at 2013-12-01 22:03:00 -0800 Processing by StatusesController#new as HTML Rendered statuses/_form.html.erb (2.1ms) Rendered statuses/new.html.erb within layouts/application (2.7ms) Completed 500 Internal Server Error in 5ms

ActionView::Template::Error (undefined method `name' for #<Status:0x007fc08f05b278>):

  <div class="field">
       <%= f.label :name %><br />
       <%= f.text_field :name %>
     </div>
     <div class="field">
       <%= f.label :content %><br />

I get this error when I click all statuses. I am using ruby 2.0.0 but I was following the treehouse track. https://github.com/andyrewlee/treebook.git

Were you able to solve this issue? I got the same one, looks like it was due to changes to some of the gems.

1 Answer

It looks like your db/schema.rb doesn't have a name column on the statuses table. That's because this migration removed it.

If that migration mistakenly removed the name column, you should create a new migration to add it back. It's best practice not to edit it:

Don't change a migration after it has been merged into master if the desired change can be solved with another migration.

If you don't want statuses to have a name, you can safely delete the name-related parts of the view that is throwing the error:

  <div class="field">
       <%= f.label :name %><br />
       <%= f.text_field :name %>
     </div>