I m passing the id
from link_to
to locals
. But it is not able to find the result, saying cannot find article without id
. I need to pass the id for display articles
in modal.
<% @articles.each do |a|%>
<p>
<%= link_to a.title, {"data-toggle" => "modal", "data-target" => '#myModal', :id => a.id}%>
</p>
<% end %>
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria labelledby="myModalLabel" aria-hidden="true">
<%= render :partial => "site#show", :locals => {@article => Article.find(params[:id])}%>
</div>
In the controller
def home
@articles = Article.order("created_at DESC").limit(5)
@videos = Video.order("created_at DESC").limit(5)
end
And i m getting the id from the controller. It is not nill.
The thing is i m able to find the articles in the block
but not being able to send it to the locals.