7

I'm getting this error "undefined method `attribute_method_matcher' for nil:NilClass".

My controller name is Cad Its function is

  def index
     @cadempty = Cad.new
     @caddata = Cad.all

  end

The error is on creating the new object. If I comment Cad.new the code works fine.

Earlier I thought it could be because I have a method named 'new' and I was Using User.new to create a blank object for the form. But its not the error I renamed the method to something else and the error still exists. I have no idea what I'm doing wrong.

Sachin Prasad
  • 5,365
  • 12
  • 54
  • 101

1 Answers1

7

Maybe one of your column names in the database table is a reserved word.

Avoid using names for methods that are reserved words in the language.

Иван Бишевац
  • 13,811
  • 21
  • 66
  • 93