From 2b6813035bbdfd5ab04a07b6bc5ba653da88010c Mon Sep 17 00:00:00 2001 From: Jamie Macey Date: Thu, 16 Jun 2022 17:07:49 -0700 Subject: [PATCH] Add deprecation warning to unused method --- lib/administrate.rb | 10 ++++++++++ lib/administrate/base_dashboard.rb | 2 ++ 2 files changed, 12 insertions(+) diff --git a/lib/administrate.rb b/lib/administrate.rb index 0827f0d293..50521ffcd5 100644 --- a/lib/administrate.rb +++ b/lib/administrate.rb @@ -20,4 +20,14 @@ def self.warn_of_deprecated_option(name) "if you think otherwise.", ) end + + def self.warn_of_deprecated_method(klass, method) + ActiveSupport::Deprecation.warn( + "The method #{klass}##{method} is deprecated. " + + "If you are seeing this message you are probably " + + "using a dashboard that depends explicitly on it. " + + "Please make sure you update it to a version that " + + "does not use a deprecated API" + ) + end end diff --git a/lib/administrate/base_dashboard.rb b/lib/administrate/base_dashboard.rb index 558919dc3c..5af4a9f7b7 100644 --- a/lib/administrate/base_dashboard.rb +++ b/lib/administrate/base_dashboard.rb @@ -94,6 +94,8 @@ def collection_includes end def item_includes + # Deprecated, internal usage has moved to #item_associations + Administrate.warn_of_deprecated_method(self.class, :item_includes) attribute_includes(show_page_attributes) end