Repository navigation
STI display, boot-time flippables check, and release 0.4.0 - #3
Merged
Merged
Conversation
With flipside_entity in User, an Admin < User record was looked up as "Admin", so its entity showed as "User #id" and display_entity(admin) raised KeyError. Look the registration up through the class's ancestors, so a subclass uses the closest registered class and its own registration still wins when it has one. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Checking the list only when the UI reads the registry meant an unlisted class using the macros, or a listed class registering nothing, passed boot and CI and failed on the first visit to the UI. The Railtie now runs the same check in after_initialize when the app eager loads. Rails eager loads before running after_initialize (6.1 through 8.1), so every class using the macros has registered by then. Without eager loading the check is left to the UI, since it would only see whatever is loaded. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
flipside_entity's cleanup is a dependent: :delete_all association, which runs on any destroy that runs callbacks, soft deletes included. Say so, since a restored record comes back without its features. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #2, which was merged at 5b5d68f — three commits on that branch landed after it and are cherry-picked here, plus the release bump.
Changes
flipside_entityinUser, anAdmin < Userrecord was looked up as"Admin": its entity showed asUser #idanddisplay_entity(admin)raisedKeyError. The registration is now looked up through the class's ancestors, so a subclass uses the closest registered class and its own registration still wins. (Handle deleted entities #2's fix covered only the subclass-registered case.)Flipside.flippablesat boot when the app eager loads. Since Handle deleted entities #2 checks the list lazily, an unlisted class using the macros, or a listed class registering nothing, passed boot and CI and failed on the first UI visit. The Railtie now runs the same check inafter_initializewheneager_loadis on. Rails eager loads beforeafter_initializein railties 6.1, 7.0 and 8.1 (checked in source). Smoke-tested by booting a minimal Rails 8.1 app against this code: listed → boots; unlisted →Flipside::Errorat boot; listed-but-missing →NameErrorat boot; no eager load → boots. That run also confirmed the deprecator is registered inRails.application.deprecators.Releasing
bundle exec rake releasedoes not work as-is:rake(andstandard) are not in the bundle. Either add them as dev dependencies or release withgem build flipside.gemspec && gem push flipside-0.4.0.gem.Note for apps upgrading
Apps that raise on deprecations (e.g.
config.active_support.deprecation = :raisein test) will fail to boot while they still callregister_entity/register_role, since the deprecator now follows the app's settings. Migrate to the macros in the same change as the bump.Testing
bundle exec rspec— 70 examples, 0 failures.🤖 Generated with Claude Code