Ian Brayoni
2014-Aug-11 02:32 UTC
Rails 2.3.5: Trouble passing params to controller method through link_to tag
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 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
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/c886e7e7af82e4420e148db3990da4c1%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.