[英]weird error popped up with active admin
我正在使用active_admin并在项目中进行设计。 有一个管理页面可以邀请甚至根本不加载的用户。 我已经尝试删除相当多的代码,以获得有关正在发生的事情的线索。 我得到的是以下错误。
NoMethodError in Admin/invitations#index
Showing /Users/ianseabock/.rvm/gems/ruby-1.9.3-p448/gems/activeadmin-0.6.2/app/views/active_admin/resource/index.html.arb where line #1 raised:
undefined method `storage_total_stat_id_eq' for #<MetaSearch::Searches::User:0x007fb9ebde5ce0>
Extracted source (around line #1):
1: insert_tag renderer_for(:index)
未定义的方法“storage_total_stat_id_eq”无法在代码库中找到。 有关正在发生的事情的任何建议?
听起来这是由Active Admin试图为其构建过滤器的关联引起的,但我猜这种关联是非标准的。 您可以使用以下代码查看默认情况下正在构建的过滤器:
ActiveAdmin.application.namespaces[:admin].resources[:User].filters
快速解决方法是删除该过滤器:
ActiveAdmin.register User do
# ...
remove_filter :storage_total_stat
# ...
end
检查是否已包含storage_total_stat_id
已包含在允许的参数中:
ActiveAdmin.register Invitation do
permit_params :storage_total_stat_id, :other, :attributes, :for, :this, :model
end
我遇到了类似的问题 - 对我而言,我的Active Admin表单中包含一个错误指定的“集合”过滤器。
我使用过User.all.where(...)而不是User.where(...)。
一旦我删除了“.all”,它就解决了问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.