Class: Spree::OrderUpdateAttributes
- Inherits:
-
Object
- Object
- Spree::OrderUpdateAttributes
- Defined in:
- app/models/spree/order_update_attributes.rb
Instance Method Summary collapse
-
#call ⇒ Object
(also: #apply)
Assign the attributes to the order and save the order.
-
#initialize(order, attributes, request_env: nil) ⇒ OrderUpdateAttributes
constructor
A new instance of OrderUpdateAttributes.
Constructor Details
#initialize(order, attributes, request_env: nil) ⇒ OrderUpdateAttributes
Returns a new instance of OrderUpdateAttributes.
9 10 11 12 13 14 |
# File 'app/models/spree/order_update_attributes.rb', line 9 def initialize(order, attributes, request_env: nil) @order = order @attributes = attributes.dup @payments_attributes = @attributes.delete(:payments_attributes) || [] @request_env = request_env end |
Instance Method Details
#call ⇒ Object Also known as: apply
Assign the attributes to the order and save the order
18 19 20 21 22 23 24 25 |
# File 'app/models/spree/order_update_attributes.rb', line 18 def call order.validate_payments_attributes(@payments_attributes) assign_order_attributes assign_payments_attributes order.save end |