module ActiveAdmin::HumanizedEnum::ViewHelpers::DisplayHelper

Public Instance Methods

format_attribute(resource, attr) click to toggle source
Calls superclass method
# File lib/active_admin/humanized_enum/view_helpers/display_helper.rb, line 5
def format_attribute(resource, attr)
  humanize_value = humanize_enum(resource, attr)

  if humanize_value
    humanize_value
  else
    super(resource, attr)
  end
end
humanize_enum(resource, attr) click to toggle source
# File lib/active_admin/humanized_enum/view_helpers/display_helper.rb, line 15
def humanize_enum(resource, attr)
  case attr
  when String, Symbol
    method = "humanized_#{attr.to_sym.downcase}"
    resource.send(method) if resource.respond_to?(method)
  end
end