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

Rails Server - Missing Method

When I try to start the rails server I get an error message saying I have a missing method or undefined method 'attr_accessible' for User.

The actual message looks like this (another persons' error message may look differently because they may have a different file setup or file names):

c:/Ruby193/lib/ruby/1.9.1/gems/activerecord-4.1.0/lib/active_record/dynamic_matchers.rb:26:in 'method_missing': undefined method 'attr_accessible' for User (call 'User.connection' to establish a connection):Class (NoMethodError)

I tried to enter User.connection into the prompt just to see if that would work but I get the error message: 'User.connection' is not recognized as an internal or external command, operable program or batch file.

1 Answer

Attr_accessible does not exist in Rails 4. The videos you are watching use rails 3.2, I suggest changing the version of rails in your gemfile and sticking to rails 3.2

OR

Skip the Treebook videos and first do the ODOT ruby on rails courses. They use rails 4 and will help you make more sense of what's going on in the Treebook videos.

Thank you, that is interesting.