You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using administrate_exportable with administrate v0.18.0 will cause a deprecation warning to get logged in test and development. They look like this:
DEPRECATION WARNING: The method `valid_action?` is deprecated. Please use `accessible_action?`
instead, or see the documentation for other options. (called from valid_action?
at <GEM_PATH>/administrate-0.18.0/app/controllers/administrate/application_controller.rb:125)
Apparently the practice of calling valid_action? and show_action? was replaced with a single call to a new method, accessible_action? in this PR: thoughtbot/administrate#1941
As 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 in app/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's link_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.
Slight tweak to my workaround code, which won't work if the model has a name that is already plural (e.g. UserSettings).
In those cases, rails has to disambiguate on collection routes, so you will have something like "export_admin_user_settings_index_path" (where the "_index" doesn't appear on models with singular names).
Something like this should work everywhere, though I haven't tested it heavily:
Activity
pablobm commentedon Mar 8, 2024
Hello 👋 Deprecator of
valid_action?here. Sorry about the change! A back-compatible option might be to do the following:valid_action?withexisting_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?.johncip commentedon Oct 29, 2025
Slight tweak to my workaround code, which won't work if the model has a name that is already plural (e.g. UserSettings).
In those cases, rails has to disambiguate on collection routes, so you will have something like "export_admin_user_settings_index_path" (where the "_index" doesn't appear on models with singular names).
Something like this should work everywhere, though I haven't tested it heavily:
Fix compatibility with Administrate v1.0.0
Fix compatibility with Administrate v1.0.0 (#57)
andreibondarev commentedon Oct 21, 2026
This is addressed in #59 and will close automatically when it's merged.
Fix open issues: empty exports, N+1 queries, Turbolinks, plural routes (