Skip to content

Commit

Permalink
Add deprecation warning to unused method
Browse files Browse the repository at this point in the history
  • Loading branch information
jamie authored and pablobm committed Jun 28, 2022
1 parent 051d846 commit 2b68130
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/administrate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions lib/administrate/base_dashboard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 2b68130

Please sign in to comment.