0

I recently started a new RoR project, and copied some of my old code from about 6 months ago.

For some reason, I'm getting the following error in my User model:

undefined method `attr_accessible' for User:Class

When I comment the attr_accessible line out, I then get a similar error in the same file:

undefined method `before_save' for User:Class

And when I comment that out, I get another one:

undefined method `validates' for User:Class

Why would attr_accessible and before_save be undefined methods? I thought those were built in to Ruby on Rails!?

Marvin K
  • 437
  • 1
  • 5
  • 11

1 Answers1

2

Is your User class inheriting from ActiveRecord::Base?

It should look like this:

class User < ActiveRecord::Base
Joel Friedlaender
  • 2,191
  • 1
  • 18
  • 24