Skip to content

Rolemodel::ResourceFor::ControllerExtension - #205

Merged
OutlawAndy merged 3 commits into
masterfrom
resource-for-controller-extension
Aug 4, 2026
Merged

Rolemodel::ResourceFor::ControllerExtension#205
OutlawAndy merged 3 commits into
masterfrom
resource-for-controller-extension

Conversation

@OutlawAndy

@OutlawAndy OutlawAndy commented Aug 3, 2026

Copy link
Copy Markdown
Member

Adds Rolemodel::ResourceFor::ControllerExtension, a small utility intended to simplify “child resources with many possible parents” by deriving the parent model and id param from route defaults (via routing concerns), and making the helper available across controllers through the engine.

Pattern extracted from TarscoBoltedTank

What Changed?

  • Introduces resource_for as a private controller method via a new ControllerExtension concern.
  • Hooks the concern into ActionController::Base via a Rails engine initializer.
  • Adds request-level spec coverage and a README section documenting routing + controller usage and security considerations.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Rolemodel::ResourceFor::ControllerExtension, a small controller utility intended to simplify “child resources with many possible parents” by deriving the parent model and id param from route defaults (via routing concerns), and making the helper available across controllers through the engine.

Changes:

  • Introduces resource_for as a private controller method via a new ControllerExtension concern.
  • Hooks the concern into ActionController::Base via a Rails engine initializer.
  • Adds request-level spec coverage and a README section documenting routing + controller usage and security considerations.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
spec/resource_for/controller_extension_spec.rb Adds an integration-style request spec to validate routing-default behavior and availability of resource_for.
README.md Documents the new controller extension, recommended routing pattern, and guidance for handling user-supplied types.
lib/rolemodel/resource_for/controller_extension.rb Defines the ControllerExtension concern and resource_for helper.
lib/rolemodel/engine.rb Loads and includes the controller extension into ActionController::Base via on_load.

Comment thread lib/rolemodel/resource_for/controller_extension.rb
Comment thread lib/rolemodel/resource_for/controller_extension.rb
@OutlawAndy
OutlawAndy marked this pull request as ready for review August 3, 2026 23:14
@OutlawAndy OutlawAndy self-assigned this Aug 3, 2026
@OutlawAndy
OutlawAndy merged commit dd95ac2 into master Aug 4, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants