[英]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.