Skip to content

Instantly share code, notes, and snippets.

@namiwang
Last active April 8, 2020 13:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save namiwang/7730be6959aa8d7e7898bf6b388837ef to your computer and use it in GitHub Desktop.
Save namiwang/7730be6959aa8d7e7898bf6b388837ef to your computer and use it in GitHub Desktop.
active admin menu humanable with count
# admin/concerns/resource_menu_humanable
module ResourceMenuHumanable
extend ActiveSupport::Concern
def self.included(base)
base.menu label: -> { "#{base.config.resource_class.model_name.human} (#{base.config.resource_class.count})" }
end
end
# admin
ActiveAdmin.register Resource do
include ResourceMenuHumanable
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment