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

Rename Shipment#update! to Shipment#update_state #2085

Merged
merged 1 commit into from
Jul 17, 2017

Conversation

jhawthorn
Copy link
Contributor

Overriding shipment.update! prevented us from calling AR::Base#update! on a shipment. This renames Shipment#update! to Shipment#update_state and deprecates calling Shipment#update! with an order as an argument.

Follow up to #2072

def update!(order_or_attrs)
if order_or_attrs.is_a?(Spree::Order)
Spree::Deprecation.warn "Calling Shipment#update! with an order to update the shipments state is deprecated. Please use Shipment#update_state instead."
if order_or_attrs.object_id != self.order.object_id

Choose a reason for hiding this comment

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

Redundant self detected.

def update!(order_or_attrs)
if order_or_attrs.is_a?(Spree::Order)
Spree::Deprecation.warn "Calling Shipment#update! with an order to update the shipments state is deprecated. Please use Shipment#update_state instead."
if order_or_attrs.object_id != self.order.object_id

Choose a reason for hiding this comment

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

Redundant self detected.

def update!(order_or_attrs)
if order_or_attrs.is_a?(Spree::Order)
Spree::Deprecation.warn "Calling Shipment#update! with an order to update the shipments state is deprecated. Please use Shipment#update_state instead."
if order_or_attrs.object_id != self.order.object_id

Choose a reason for hiding this comment

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

Redundant self detected.

@jhawthorn jhawthorn changed the title Rename shipment.update! to shipment.update_state Rename Shipment#update! to Shipment#update_state Jul 12, 2017
Overriding shipment.update! prevented us from calling AR::Base#update!
on a shipment. This renames Shipment#update! to Shipment#update_state
and deprecates calling Shipment#update! with an order as an argument.
Copy link
Contributor

@cbrunsdon cbrunsdon left a comment

Choose a reason for hiding this comment

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

Looks good to me, doesn't look any more or less controversial than the other two update! fixes, thanks hawth.

@jhawthorn jhawthorn merged commit 8e3af2a into solidusio:master Jul 17, 2017
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.

3 participants