Last Updated: February 25, 2016
·
2.965K
· jandudulski

Custom finder for active admin

ActiveAdmin use Resource#find method for finding, but there are cases when you would like to change this behavior. E.g. if you're using mongoidslug. Solution is simple and comes from inheritedresource (https://github.com/josevalim/inherited_resources/blob/master/lib/inherited_resources/class_methods.rb#L33):

ActiveAdmin.register Something do
  controller do
    defaults :finder => :find_by_slug
  end
end