Ruby on Rails Monday, May 4, 2015

On 4 May 2015 at 15:47, Padmahas Bn <padmahas@gmail.com> wrote:
> After following so many Stackoverflow and other related posts I was able to
> render modal (_show.html.erb) from inside index.html.erb. But the problem
> the parameter I'm sending is showing same id and other details for all show
> buttons.
>
> For instance if there are 5 different members listed in index.html.erb, when
> I press the corresponding show button, the same id and other details as the
> first member is showing for all members.
>
> index.html.erb
> <tbody>
> <% @designation_dicts.each do |designation_dict| %>
> <tr>
> <td><%= designation_dict.desig_code %></td>
> <td><%= designation_dict.designation %></td>
>
> <td><%= render :partial => "show", :locals => {:designation_dict =>
> designation_dict} %></td>
> <td><%= link_to 'Show', "#myModal", "data-toggle" => "modal", :class
> => 'btn btn-default' %></td>

Do you mean that when you click this link it does not show the correct
one? If so then have a look at the html the for the link in the
browser (View Source, or something similar in the browser to see it,
Ctrl+U in Firefox) to see if it is correct and look in development.log
to see what parameters are passed for it when you click it.

Colin

--
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@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLs-f2Ua6rKTvd5%2B1VhHoMJtfCdoW8XxnRty7LGkJBHWQQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment