簡體   English   中英

網格視圖的自定義過濾器不起作用:找不到'id'= all

[英]Custom filter for grid view not working: Couldn't find with 'id'=all

我正在使用wice_grid,並按照gem的說明為兩個關聯的模型定義了一個自定義過濾器。 我有:

g.column name: 'Organization', filter_type: :string, attribute: 'name', model: 'Organization', auto_reload: true, html: {id: 'grid-cells'},
         custom_filter: Organization.find(:all).map{|pr| [pr.name, pr.name]} do |user|
  link_to(user.organization.name, organization_path(user.organization))
end

這將產生錯誤:

Couldn't find Organization with 'id'=all

知道我在做什么錯嗎?

使用Organization.all 在最新版本的rails中不推薦使用find(:all)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM