Commit ce35929
Patch administrate to avoid incorrect deprecation
Previously I was seeing many instances of the following deprecation
warning when running `spec/features/admin/schools_spec.rb` which was
cluttering up the build output making it hard to see genuine problems:
DEPRECATION WARNING: The option :class_name is deprecated.
Administrate should detect it automatically.
This was because when the automatic associations functionality [1] was
added to administrate in v0.15.0, the `class_name` option on
`Administrate::Field::Associative#associated_class_name` which is the
superclass for `Administrate::Field::BelongsTo`. The latter is used on
the `SchoolDashboard` with the `class_name` option [3].
However, in the v1.0.0.beta3 release of administrate [4], this
deprecation was reversed [4]. So we could avoid the deprecation by
upgrading administrate. However, since it's a major version bump, it's
like to be a chunk of work. So instead I've patched this specific
functionality to avoid the deprecation warning.
The patch includes code which will fail fast once administrate is
updated to v1.0.0.beta3 or later so that the patch can be removed.
[1]: thoughtbot/administrate#1633
[2]: https://github.com/thoughtbot/administrate/blob/f7287410a93d07f222bd5d4fb5055c6937eace08/CHANGELOG.md#0150-february-26-2021
[3]: https://github.com/RaspberryPiFoundation/editor-api/blob/f397e870f2a33cce1f53b9104c52314f5233572c/app/dashboards/school_dashboard.rb#L14
[4]: thoughtbot/administrate#26971 parent 79f316c commit ce35929
1 file changed
+21
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
0 commit comments