ruby on rails 3.2 - ActiveRecord::RecordNotFound (Couldn't find Batch without an ID) -


basically have dropdown that's meant launch partial calling method in controller. partial shown below:

<%= form_for :exam_report, :url=>{:action=>'generated_report'} |z| %>  <%= select_tag :exam_report_batch,  options_for_select( batch.find(:all,:select=>"name,id").collect{|c| [c.name,c.id]}), :data => { :remote => true, :url => url_for(:controller => "exam",                                   :action => "list_exam_types",                                  :prompt =>"select batch")} %>    <div id="exam-group-select">  <%= select :exam_report, :exam_group_id, @exam_groups.map{|exam| [exam.name,exam.id]},:prompt=> "#{t('select_exam_group')}" %> </div>   <%= z.submit "view", class: "btn btn-large btn-primary" %>   <% end %> 

the "list_exam_types" method in exam controller shown below:

def list_exam_types batch = batch.find(params[:batch_id]) @exam_groups = examgroup.find_all_by_batch_id(batch.id) respond_to |format|    format.html    format.js    end end 

so when select batch dropdown, following error: activerecord::recordnotfound (couldn't find batch without id): app/controllers/exam_controller.rb:224:in `list_exam_types'

my routes shown below:

resources :batches resources :exam_groups resources :additional_exam_groups resources :elective_groups end   resources :exam_groups resources :exams   member     post :save_scores   end end end 

i think have down routes don't know why params[:batch_id] empty. appreciated, thanx!


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -