Working on https://github.com/thoughtbot/administrate/pull/1941, I noticed that model-less dashboards (also known as "custom dashboards") do not behave very consistently. Eventually I found myself having to fix this before I could work on the former PR.
There are some twists and turns in the code that handles them:
- There doesn't seem to be a way to have the navigation show a singular name for the dashboard. So for instance in the example app we have "Stats", but I couldn't create one with the name "Home".
- When used with Punditize, it requires the policy to use a plural name (
HomesPolicy
) instead of singular like for any other resource. - The example
StatsDashboard
declaresresource "Stats"
, which is a weird mix of singular and plural (in the end it doesn't seem to matter which one you use here). - Internally this complicates things when working with authorization.
This PR introduces consistency, not fixing point 1 but at least addressing the other points and allowing me to proceed with my work at #1941. Original I was going to bundle it as part of the larger PR, but I thought it deserved scrutiny enough to have its own one.
As for the issue with singular names, this looks like a larger problem that should be looked into with more time, and it's probably related to how we currently can't generate dashboards for singular resources.