1
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 registration is to select students and courses to register the class. I did the following:
Model student:
class Aluno < ActiveRecord::Base
belongs_to :curso
belongs_to :class_rom
Model course:
class Curso < ActiveRecord::Base
has_many :alunos
belongs_to :class_roms
Model class:
class ClassRom < ActiveRecord::Base
has_many :alunos
has_many :cursos
ai made a scheme in the class registration form where a select box appears to choose the student’s name and the course name:
<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 a mistake saying method not found 'student'
if anyone knows what I can do to ruin it, because so far I haven’t found anything anywhere