Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

undefined method `attribute_method_matcher' for nil:NilClass

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.

like image 340
Sachin Prasad Avatar asked Dec 26 '12 17:12

Sachin Prasad


1 Answers

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.

like image 155
Иван Бишевац Avatar answered Oct 21 '22 06:10

Иван Бишевац