-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Refactoring Admin::ProductsController to use ResourcesController#update #3603
Conversation
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.
Nice. Good refactoring.
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.
Thanks @softr8, just left a small comment!
render action: 'edit' | ||
end | ||
|
||
def check_if_updating_variant_property_rules |
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.
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.
7c2ccf2
to
969676f
Compare
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.
Thanks, @softr8! I'll take care of adding a special CHANGELOG entry for this, just in case people are overriding this method.
Looking good, thanks @softr8! |
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: