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

Dongju Seo
2,339 Pointsundefined method error in Ruby on Rails!
NoMethodError in Statuses#edit
Showing c:/treebook/app/views/statuses/_form.html.erb where line #13 raised:
undefined method `user_id' for #<Status:0x4151d90> Extracted source (around line #13):
10: </ul> 11: </div> 12: <% end %> 13: <%= f.input :user_id %> 14: <%= f.input :content %> 15: <div class="form-actions"> 16: <%= f.button :submit %>
the 13th line is where the error is..
I created and edited this .rb file along with 'Installing simple_form'
class AddUserIdToStatuses < ActiveRecord::Migration def change add_column :statuses, :user_id, :integer add_index :statuses, :user_id remove_column :statuses, :name end
end
[status.rb]
class Status < ActiveRecord::Base attr_accessible :content, :user_id
end
Please give me your solution!
1 Answer

Jason Seifer
Treehouse Guest TeacherHey Dongju Seo sorry for the trouble! Jim fixes that issue in the following video:
Try following along there and let us know if you still have problems.
Dongju Seo
2,339 PointsDongju Seo
2,339 PointsI just found that add_user_id_to_statuses.rb was named as 'add_user_to_statuses.rb'! Could this be the cause of that error? so,, I typed 'rake db:reset' and 'rake db:migrate', and the latter aborted.
Projects/treebook/db/test.sqlite3> db/development.sqlite3 already exists -- create_table("statuses", {:force=>true}) -> 0.1290s -- add_index("statuses", ["user_id"], {:name=>"index_statuses_on_user_id"}) -> 0.0980s -- create_table("users", {:force=>true}) -> 0.1320s -- add_index("users", ["email"], {:name=>"index_users_on_email", :unique=>true})
_statuses.rb:3:in
change' C:in
migrate' Tasks: TOP => db:migrate (See full trace by running task with --trace)PS. when I wrote one status, It gave me a similar error.
NoMethodError in Statuses#index
Showing c:/Projects/treebook/app/views/statuses/index.html.erb where line #10 raised:
undefined method `full_name' for nil:NilClass Extracted source (around line #10):
Jason Seifer
Treehouse Guest TeacherJason Seifer
Treehouse Guest TeacherIt looks like you already have the user_id column in your statuses table. Try doing a rake db:reset and rake db:migrate and let us know if it works.
Dongju Seo
2,339 PointsDongju Seo
2,339 PointsThanks, I just fixed it.