如何分析“未定义方法`attribute_method_matcher’”错误的来源?

我在Rails控制器中创建新类时遇到错误。

我怎么能理解这里发生了什么? 谢谢

Error: NoMethodError in MystudentsController#new undefined method `attribute_method_matcher' for nil:NilClass Rails.root: E:/Nam 4 HK 1/TT CNPM/workspace/lab2 app/controllers/mystudents_controller.rb:27:in `new' app/controllers/mystudents_controller.rb:27:in `new' 

这是mystudent_controller.rb文件中的新function:

 def new @mystudent = Mystudent.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @mystudents } end end 

我相信表中的一个列名是保留字。
为学生,class级或类似的东西寻找典型的东西……
这通常会触发这个 – “ attribute_method_matcher

你有一个错字。 @mystudents需要@mystudent

您收到此错误消息是因为变量@mystudents [sic]从未分配过,因此为零。