A strange error appeared with an active administrator

I use active_admin and am developing a project. There is an admin page to invite users who wonโ€™t even load. I tried removing quite a lot of code to get some clues as to what was going on. All I get is the following error.

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) 

The undefined method "storage_total_stat_id_eq" does not exist in the codebase. Any suggestions on what's going on?

+6
ruby-on-rails devise activeadmin
source share
3 answers

This seems to be caused by the connection that Active Admin is trying to create for the filter, but I assume the association is non-standard. You can see which filters are built by default with this bit of code:

 ActiveAdmin.application.namespaces[:admin].resources[:User].filters 

A quick fix is โ€‹โ€‹to remove this filter:

 ActiveAdmin.register User do # ... remove_filter :storage_total_stat # ... end 
+8
source share

Make sure you include storage_total_stat_id in the allowed options:

 ActiveAdmin.register Invitation do permit_params :storage_total_stat_id, :other, :attributes, :for, :this, :model end 
+1
source share

I had a similar problem - and for me it was that my active admin form included a โ€œcollectionโ€ filter that was incorrectly specified.

I used User.all.where (...) instead of User.where (...).

As soon as I removed the ".all", it fixed the problem.

+1
source share

All Articles