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

Add index route for arbitrary resource path collections #13759

Merged
merged 2 commits into from Feb 15, 2017

Conversation

imtayadeway
Copy link
Contributor

@imtayadeway imtayadeway commented Feb 3, 2017

This helps simplify the SettingsController by removing a conditional. The benefit to AutomateController 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

end

def ae_browser
@ae_browser ||= MiqAeBrowser.new(User.current_user)
Copy link
Member

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).

Copy link
Contributor Author

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

Copy link
Member

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))
Copy link
Member

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.

@miq-bot
Copy link
Member

miq-bot commented Feb 15, 2017

Checked commits imtayadeway/manageiq@d065f1e~...0d86284 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
3 files checked, 0 offenses detected
Everything looks good. 👍

@abellotti
Copy link
Member

Thanks @imtayadeway for the update, will merge when 🍏

@abellotti
Copy link
Member

LGTM!!

@abellotti abellotti merged commit 3210551 into ManageIQ:master Feb 15, 2017
@abellotti abellotti added this to the Sprint 55 Ending Feb 27, 2017 milestone Feb 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants