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

the user.rb file differs from the course example

I'm following the course for building my first app on ruby on rails. When I have to modify the user.rb file (app/models/user.rb) I find that it differs a few lines from the course example. This are the lines missing:

attr_accessible :email, :password, :password_confirmation, :remember_me,

When I add these lines, and run the server, I get an error message:

undefined method `attr_accessible' for #<Class:0x4050738>

I can't understand what is wrong, I've already re-check all the course up to this point.

1 Answer

The course is written in Rails 3.2 and you're most probably using version 4 or higher. This is a common problem with this course and you can either create the project again using Rails 3.2 (then you can follow the videos without problems) or try to translate it into Rails 4+, which will be challenging. You can also move to Rails 4 Todo Application course.

Here's some more info: https://teamtreehouse.com/forum/attraccessible-missing-in-rails-4-heres-the-workaround-for-the-treebook-tutorial