I'm trying to pass the foreign key from one view to another using partial render. However there is a problem in passing the local variable because only the last record get to be displayed.
Gist link: https://gist.github.com/ReemAlattas/5d08b0b60fc890540c7b
Thanks in advance for your help!
In the _select.html.erb
file you should fix this row (previously used @p_id seems to be nil):
<% @kpis.each do |kpi| if kpi.plan_id == p_id %>
and in index.html.erb
you are passing to the partial a symbol :p_id
against the p_id
value, let replace it with:
<%= render :partial => "kpis/select", locals: {plan_id: p_id} %>