module ActiveAdmin::DisplayHelper
def display_name_method_for(resource)
To prevent conflicts, we exclude any methods that happen to be associations.
Looks up and caches the first available display name method.
def display_name_method_for(resource) @@display_name_methods_cache ||= {} @@display_name_methods_cache[resource.class] ||= begin methods = active_admin_application.display_name_methods - association_methods_for(resource) method = methods.detect { |method| resource.respond_to? method } if method != :to_s || resource.method(method).source_location method else DISPLAY_NAME_FALLBACK end end end