-
-
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
Rename Shipment#update! to Shipment#update_state #2085
Conversation
core/app/models/spree/shipment.rb
Outdated
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 |
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.
Redundant self detected.
core/app/models/spree/shipment.rb
Outdated
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 |
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.
Redundant self detected.
core/app/models/spree/shipment.rb
Outdated
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 |
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.
Redundant self detected.
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.
6066017
to
66aba46
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.
Looks good to me, doesn't look any more or less controversial than the other two update! fixes, thanks hawth.
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