-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Work around issue with Rails 7 + Ruby 3
- Loading branch information
Showing
4 changed files
with
48 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
module Administrate | ||
module Generators | ||
# This class serves only to work around a strange behaviour in Rails 7 | ||
# with Ruby 3. | ||
# | ||
# After running the spec for DashboardGenerator, the fake models that | ||
# it generates (eg: Foo, Shipment) linger around despite being removed | ||
# explicitly. This causes RouteGenerator to take them into | ||
# account and generate routes for them, which its spec doesn't expect, | ||
# causing a spec failure. | ||
# | ||
# To avoid this, the spec for DashboardGenerator defines its fake models | ||
# as children of TestRecord. Then RoutesGenerator explicitly filters | ||
# child classes of TestRecord when figuring out what models exist. | ||
# | ||
# Discussion at https://github.com/thoughtbot/administrate/pull/2324 | ||
class TestRecord < ApplicationRecord | ||
self.abstract_class = true | ||
end | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters