0
我有一個搜索結果頁面,列出找到的項目。在該列表中,我有一個我想用來顯示結果縮略圖的按鈕。如何將現有集合傳遞給控制器以呈現頁面
我有控制器的方法,顯示搜索到的圖像:
def search
@search_criteria = params[:search]
@novels = Novel.where("lower(name) like ?", "%#{@search_criteria.downcase}%")
@novels.sort! { |a,b| a.name.downcase <=> b.name.downcase }
@searched_illustrations = Illustration.where("lower(name) like ?", "%#{@search_criteria.downcase}%")
@tagged_illustrations = Illustration.tagged_with([@search_criteria], :any => true, :wild => true)
@illustrations = @searched_illustrations + @tagged_illustrations
@illustrations.uniq!
@illustrations.sort! { |a,b| a.name.downcase <=> b.name.downcase }
respond_to do |format|
format.html #search_results.html.erb
end
end
這裏是我已附加到視圖上的按鈕,顯示搜索結果的代碼:
<%= link_to "Show", illustration, :class => "btn btn-custom-primary btn-mini", :style => "float:right;" %>
這裏是控制器方法我必須顯示縮略圖:
def show_illustrations
@illustrations = params[:illustrations]
@illustrations = Kaminari.paginate_array(@illustrations).page(params[:page]).per(20)
respond_to do |format|
format.html #search_results.html.erb
end
end
我得到這個呃ROR,這使我相信我得到例證ID數組作爲PARAMS [說明]:
undefined method `aws_image_thumbnail_url' for "2":String