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

Refactoring Admin::ProductsController to use ResourcesController#update #3603

Merged

Conversation

softr8
Copy link
Contributor

@softr8 softr8 commented May 1, 2020

It takes advantage of all validations and error handling that
ResourcesController already does, it looks like the code was
just copied and added a bit that could have been handled with
before action and resources controller callbacks.

Checklist:

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have updated Guides and README accordingly to this change (if needed)
  • I have added tests to cover this change (if needed)
  • I have attached screenshots to this PR for visual changes (if needed)

Copy link
Member

@jarednorman jarednorman left a comment

Choose a reason for hiding this comment

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

Nice. Good refactoring.

Copy link
Member

@aldesantis aldesantis left a comment

Choose a reason for hiding this comment

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

Thanks @softr8, just left a small comment!

render action: 'edit'
end

def check_if_updating_variant_property_rules
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't look like this is a check, it seems more like a normalization? Perhaps a better name for this method would be something like normalize_variant_property_rules?

It takes advantage of all validations and error handling that
ResourcesController already does, it looks like the code was
just copied and added a bit that could have been handled with
before action and resources controller callbacks.
@softr8 softr8 force-pushed the refactor-admin-products-controller branch from 7c2ccf2 to 969676f Compare May 4, 2020 14:18
Copy link
Member

@kennyadsl kennyadsl left a comment

Choose a reason for hiding this comment

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

Thanks, @softr8! I'll take care of adding a special CHANGELOG entry for this, just in case people are overriding this method.

@kennyadsl kennyadsl requested a review from aldesantis May 6, 2020 11:03
@kennyadsl kennyadsl added Important Change changelog:solidus_backend Changes to the solidus_backend gem labels May 6, 2020
@aldesantis
Copy link
Member

Looking good, thanks @softr8!

@aldesantis aldesantis merged commit b539d47 into solidusio:master May 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:solidus_backend Changes to the solidus_backend gem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants