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

RoR Beginner Project: Creating relationships

Hello, everybody I am having trouble getting around the "NoMethodError in Statuses#show"/undefined method `first_name'. I read the other posts of people who have had the same issue in the past and have tried several things already -- rails console delete statuses/users, rake db:reset/create/migrate. So, I dug into my sqlite3 database and noticed that the user_id row is not populating (remains blank) when I post a new status. Any thoughts on how to get it to add the appropriate user_id when they post a status? *I am running ruby 2.0.0p247 and rails 4.0.0.

Thank you in advance for your help.

can you show us the code you are trying. Particularly the #show action in the statuses controller. Also, your #new and #create, so probably best to just copy the whole statuses controller.

Also, Rails 4 changes things from Rails 3.2.12 (which is the one the videos use). That could cause issues.

Hey Brandon, thank you for your quick response. I found the origin of my error in my status_controller.rb. I changed the status_params to accept :user_id rather than :name. For anyone else who has the same problem, feel free to check out my code below:

private
   def set_status
     @status = Status.find(params[:id])
   end

   def status_params
     params.require(:status).permit(:user_id, :content)
   end
end

Cheers, Chris

1 Answer

Jason Seifer
STAFF
Jason Seifer
Treehouse Guest Teacher

Just a heads-up: our videos use rails 3.2.12 and Ruby 1.9.3. For the most part, using ruby 2.0 will be fine but there will be a lot of differences between rails 4 and 3 that may be painful to work through.