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


NoMethodError in Statuses#new : Complete Ruby on Rails build a simple web app

NoMethodError in Statuses #new

Showing /Users/ScottDAlessandro/code/treebook/app/views/statuses/_form.html.erb where line #16 raised:

undefined method `full_name' for #<Status:0x0000010376cc40> Extracted source (around line #16):

13: 14: <div class="field"> 15: <%= f.label :full_name %><br /> 16: <%= f.text_field :full_name %> 17: </div> 18: <div class="field"> 19: <%= f.label :content %><br /> Trace of template inclusion: app/views/statuses/new.html.erb

Rails.root: /Users/ScottDAlessandro/code/treebook

Application Trace | Framework Trace | Full Trace app/views/statuses/form.html.erb:16:in `block in _app_views_statusesform_html_erb871609707240624879_2176560820' app/views/statuses/_form.html.erb:1:in `_app_views_statusesform_html_erb871609707240624879_2176560820' app/views/statuses/new.html.erb:3:in `_app_views_statuses_new_html_erb_3089828772916649988_2174583640' app/controllers/statuses_controller.rb:29:in `new' Request


None Show session dump

Show env dump


<%= form_for( @status ) do |f| %> <% if @status .errors.any? %> <div id="error_explanation"> <h2><%= pluralize( @status .errors.count, "error") %> prohibited this status from being saved:</h2>

I get this error when I try updating a status on my page. Here are a few other files I updated recently.

      <%  @status .errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
   <% end %>

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


class AddUserIdToStatuses < ActiveRecord::Migration
  def change
    add_column :statuses, :user_id, :integer
    add_index :statuses, :user_id
    remove_column :statuses, :name

Sorry for a poor description but I am lost for words on this error. I am not 100% when this error surfaced, it seemed everything was going fairly smoothly throughout the project. Does anyone know where I could have went wrong or why I am getting this error? Thanks :)

1 Answer

What does your user.rb file look like?

If you have recently added the full_name method, you may need to delete all statuses.