Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow users to customize ActiveStorage controllers without having to override them #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

santib
Copy link
Owner

@santib santib commented Jun 12, 2023

Summary

Other Information

@pr-explainer-bot
Copy link

Hi there! Here's the Pull Request report for the commit history you provided:

Changes

  1. In activestorage.rb file, added parent_controller attribute to ActiveStorage module.
  2. In proxy_controller.rb, redirect_controller.rb, direct_uploads_controller.rb, representations/proxy_controller.rb, and representations/redirect_controller.rb files, changed the parent class of the controllers to the value of ActiveStorage.parent_controller.constantize.

Suggestions

No suggestions provided.

Bugs

No bugs found.

Improvements

No improvements suggested.

Refactoring

In activestorage.rb file, instead of using default: "ActiveStorage::BaseController", we can use default: -> { ActiveStorage::BaseController } to avoid string interpolation.

module ActiveStorage
  mattr_accessor :parent_controller, default: -> { ActiveStorage::BaseController }
end

Rating

I would rate this code a 8 out of 10. The code is well-organized and easy to read. The addition of the parent_controller attribute is a useful customization option. However, there is room for improvement in terms of performance optimization.

santib pushed a commit that referenced this pull request Dec 31, 2023
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.

None yet

1 participant