On Monday, August 11, 2014 4:33:19 AM UTC+2, Ruby-Forum.com User wrote: > > Hi guys, > > I have been trying to pick up rails and I am having trouble passing > parameters through a link_to tag so as to retrieve records where there > is a parameter match. > > https://gist.github.com/Brayoni/3102c5dab7f76b1cee7b > > Here is my view; > <% @employees.each do |employee| %> > > <div class="name_list<%=cycle('odd', 'even')%>"><li> > <label><%= check_box_tag "retrieve_case[employee_ids]", > employee.id, false,:class=>'right' %> > <div class="att_list_names"><%= employee.first_name > %></div> </label> > </li> </div> > <% end %> > </div> > > <%= link_to "#{t('retrieve_case')}", {:controller => > 'employee_indisciplines', :action => 'show_indisciplines', :employee.id > => params[:retrieve_case]}, { :class => 'submit_button' }, :method => > 'post' %> > > > controller method; > def show_indisciplines > if request.post? > activated_ids = params[:retrieve_case][:employee_ids].collect > {|employee_id| employee_id.to_i} > > if activated_ids > @employee_indiscipline = > EmployeeIndiscipline.find_all_by_employee_id(params[:employee_id]) > end > end > end > > -- > Posted via http://www.ruby-forum.com/. >
You reference the variable in your view :employee_id => @retrieve_case.inspect but it is not initialised yet, because you will get it only in your controller -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/a1f47887-2711-4c2f-a764-b412690dbfbc%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

