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
Add index route for arbitrary resource path collections #13759
Conversation
b0b1947
to
e710afa
Compare
e710afa
to
d065f1e
Compare
end | ||
|
||
def ae_browser | ||
@ae_browser ||= MiqAeBrowser.new(User.current_user) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I woudn't memoize this. Recreate it with each request (User.current_user may be different).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not memoized across requests - each request is a new instance
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
render_resource :settings, ::Settings.to_hash.slice(*Array(selected_sections).collect(&:to_sym)) | ||
def show | ||
raise NotFoundError, "Settings category #{@req.c_id} not found" unless exposed_settings.include?(@req.c_id) | ||
render_resource :settings, ::Settings.to_hash.slice(*Array(@req.c_id).collect(&:to_sym)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicated logic with line 4 for ::Settings.to_hash.... maybe a common method.
Checked commits imtayadeway/manageiq@d065f1e~...0d86284 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
Thanks @imtayadeway for the update, will merge when 🍏 |
LGTM!! |
This helps simplify the
SettingsController
by removing a conditional. The benefit toAutomateController
is less tangible, but I do like that it encouraged smaller methods and code reuse, while making things more consistent and "Rails-y"@miq-bot add-label api, refactoring
@miq-bot assign @abellotti