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
Written by Jan Dudulski
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#