Skip to content

WIP: Refactor ApplicationController into composable concerns - #3066

Open
goosys wants to merge 1 commit into
thoughtbot:mainfrom
goosys:refactor/application_controller
Open

goosys wants to merge 1 commit into
thoughtbot:mainfrom
goosys:refactor/application_controller

Conversation

@goosys

@goosys goosys commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Refactor Administrate::ApplicationController by splitting its responsibilities into focused concerns.

The default controller includes all concerns required for the existing HTML CRUD behavior, so this change preserves the current behavior while making customization more explicit.

With this structure, custom controllers can compose only the functionality they need. For example:

  • A controller that does not render HTML can omit HtmlRenderer
  • Custom controllers can include only the actions they need, such as index, or new and create.
  • Kaminari pagination can be replaced with a custom pagination concern
  • The default search implementation can be replaced with Ransack, Elasticsearch, or another solution

I understand the concern that concerns can hide methods that still belong to the controller. In this case, however, the goal is not only to organize methods, but to make each responsibility independently composable and replaceable. The included concerns are explicitly listed in ApplicationController, and custom controllers can choose their own composition.

Existing HTML CRUD behavior and customization points are preserved.

WIP

  • Validation context support is included, but has not been merged yet.
  • Unit tests for each concern still need to be added.
  • Documentation still needs to be updated.
  • Discussion about the granularity of method extraction and module naming.

@goosys

goosys commented Sep 18, 2026

Copy link
Copy Markdown
Contributor Author

@pablobm @nickcharlton

I’d like to reopen this discussion. Do you have any thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ApplicationController refactoring

1 participant