Open johncip opened 1 year ago
Hello :wave: Deprecator of valid_action?
here. Sorry about the change! A back-compatible option might be to do the following:
valid_action?
with existing_action?
.existing_action?
.
valid_action?
. (This will support older versions).Administrate.warn_of_deprecated_authorization_method
.But none of this is supported, and generally it's recommended to use accessible_action?
.
Issue
Using administrate_exportable with administrate v0.18.0 will cause a deprecation warning to get logged in test and development. They look like this:
Apparently the practice of calling
valid_action?
andshow_action?
was replaced with a single call to a new method,accessible_action?
in this PR: https://github.com/thoughtbot/administrate/pull/1941As far as I can tell, that PR is part of administrate v0.18.0, and unfortunately
accessible_action?
doesn't exist in versions before v0.18.0.I'm guessing that making the deprecation warning go away at the cost of breaking compatibility with older versions isn't worth it, and neither is making the behavior conditional on e.g.
Gem.loaded_specs["administrate"].version
... but I thought I'd make this issue for documentation value at least.Workaround
The change, were it made, would result in the export button's
link_to
inapp/views/admin/application/_index_header.html.erb
becoming:Folks using the latest administrate who wish to avoid the warning can simply copy administrate_exportable's version of
_index_header.html.erb
into their project, and update the export button'slink_to
to the above. (Generating views in administrate didn't spit out the file when I tried it.)Finally, it might be of some use to update the readme to provide both versions -- @andreibondarev I'm happy to make a PR with whatever change is desired, if a change is desired at all.