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

Stuck at Simple Ruby Application

I'm currently at Stage4 (Creating Relationships). I'm using the latest Ruby, and latest RoR.

I'm having a problem with storing the user_id. I've made all the steps this far, and whenever I go to edit a status, and update the user_id it simply doesn't store the user_id!

I'm stuck there, because I can't keep going forward on the lesson while I have this problem!

This is the code I'm using, exactly the same as the video!

<div class="form-group">
     <%= f.input :user_id %>
     <%= f.input :content, label: 'Tweet', label_html: {class: 'control-label'}, input_html: {class: 'form-control'} %>
</div>

The only difference is that on app/models/status.rb, I don't have attr_accessible (whenever I add this, another problem raises). This is my status.rb

class Status < ActiveRecord::Base
    belongs_to :user
end

Hope you guys can help!

1 Answer

Sean Perryman
Sean Perryman
13,810 Points

Check your rails version at the command line

rails version

The course was written with Rails 3 in mind, and they've changed quite a bit of stuff since then. Check out this thread: https://teamtreehouse.com/forum/nomethoderror-in-statusesshow