I am trying to setup a custom filter with my ActiveAdmin installation and it is returning some errors.
User Model:
class User < AR::Base
has_many :gpas
def current_gpa
return nil if gpas.blank?
@current_gpa ||= (gpas.where(year: classification).first || gpas.order("updated_at DESC").first)
end
end
ActiveAdmin:
ActiveAdmin.register Athlete do
filter :current_gpa_value, as: :string
end
The error I get is:
ActionView::Template::Error (undefined method current_gpa_value_contains for #<MetaSearch::Searches::User:0x007f982df8fd28>)
ActiveAdmin uses metasearch for filters. Check out this example of how to set up a custom search method.