How can I parse the source of an undefined `attribute_method_matcher 'error?

I get an error when creating a new class in the Rails controller.

How can I understand what is going on here? Thanks

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' 

And this is a new function in the mystudent_controller.rb file:

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

I believe one of your column names in the table is a reserved word.
Look for typical things for a student, class, or something like that ... It usually calls this - attribute_method_matcher

+5
source

You have a typo there. @mystudents must be @mystudent .

You get this error message because the @mystudents [sic] variable has never been assigned and therefore is zero.

-one
source

All Articles