Method: Effective::Order#update_prices!

Defined in:
app/models/effective/order.rb

#update_prices!Object



288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
# File 'app/models/effective/order.rb', line 288

def update_prices!
  raise('already purchased') if purchased?
  raise('must be pending or confirmed') unless pending? || confirmed?

  present_order_items.each do |item|
    purchasable = item.purchasable

    if purchasable.blank? || purchasable.marked_for_destruction?
      item.mark_for_destruction
    else
      item.assign_purchasable_attributes
    end
  end

  save!
end