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