Undefined method in Ruby

1

I'm trying to make a relationship between two tables in Ruby, where I use the student and notes but when I go into localhost: 3000 / students / 1 / notes it gives me the error

asked by anonymous 10.11.2017 / 16:10

1 answer

0

You're saying that Note belongs to Student , and trying to access it in a way it will not allow, and will have the error response:

  

noMethodError in NotesController # index   undefined method 'notes' for #

To resolve, just like it was done in the comments, go to the Student class and call it the .find()

@student = Student.find(params[:student_id])
    
10.11.2017 / 18:48