繁体   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