Today I come with another question, but about code. Next, I am making a system to register students and courses and a screen to register classes where part of the register is to select students and courses to register the class. I did the following:
Student model:
class Aluno < ActiveRecord::Base
belongs_to :curso
belongs_to :class_rom
Course model:
class Curso < ActiveRecord::Base
has_many :alunos
belongs_to :class_roms
Class model:
class ClassRom < ActiveRecord::Base
has_many :alunos
has_many :cursos
I made a schema in the class registration form where a select box appears to choose the name of the student and the name of the course:
<div class="field">
<%= f.label :aluno_id %><br>
<%= f.collection_select(:aluno_id, @alunos,
:id, :nome, :prompt => true) %>
</div>
<div class="field">
<%= f.label :curso_id %><br>
<%= f.collection_select(:curso_id, @cursos,
:id, :nome, :prompt => true) %>
</div>
<div class="actions">
<%= f.submit %>
</div>
But at the time of registering an error saying method not found 'student'
If anyone knows what I can do to arurmar, because until now I have not found anything anywhere