brooksworm
New Member
I'm trying to create a registration for students to be able to register for the sections that are available to them. However, I keep getting this error when i actually hit the create registration button. When i check the live shell it says that @student == nil meaning it's not being created properly? I'm confused as to how I could fix this though\[code\]<!---REGISTRATION CONTROLLER-->def new @registration = Registration.new @student = Student.find(params[:student_id]) @info = Section.for_rank(@student.rank).for_age(@student.age).map{|s| ["Name: #{Event.find_by_id(s.event.id).name}, Ranks: #{ s.max_rank == nil ? "#{Student::RANKS[s.min_rank-1][0]} and up" : "#{Student::RANKS[s.min_rank-1][0]} - #{Student::RANKS[s.max_rank-1][0]}"}, Ages: #{ s.max_age == nil ? "#{s.min_age} and up" : "#{s.min_age} - #{s.max_age}" }", s.id] }enddef create @registration = Registration.new(params[:registration]) if @registration.save redirect_to @registration, :notice => "Successful" else render :action => 'new' endend<!----MY REGISTRATION FORM --><div class="field"><%= f.hidden_field :student_id, :value =http://stackoverflow.com/questions/15734231/> @registration.student_id %>\[/code\]\[code\]<div class = "field"><%= f.select :section_id, options_for_select(@info)%>\[/code\]\[code\]<div class="actions"><%= f.submit nil, :class => 'btn btn-mini' %></th>\[/code\]\[code\]<!--- MY STUDENT SHOW THAT CALLS THE REGISTRATION --><%= link_to 'Register ', new_registration_pathstudent_id => @student.id), :class => 'btn btn-mini' %>\[/code\]