0
我编辑的源index.html.erb页面查看设置PARAMS:ID发布
<% @sources.each_slice(20) do |s| %>
<div class="span3">
<% s.each do |i| %>
<div><%= link_to(truncate(i.name, :length => 30) , sources_path(i.id), :class => 'action show') %></div>
<% end %>
</div>
<% end %>
的sources.controller是..
def index
@sources = Source.search(:search=>params[:search])
respond_to do |format|
format.html # index.html.erb
format.json { render json: @sources }
end
end
问:当PARAMS [ :搜索]有效。为什么要显示i.name信息并且i.id不显示...我如何获取i.id?
即使我将其更改为
它生成的HTML是什么? – 2012-04-16 15:33:39