app/models/bodega/order.rb in bodega-0.4.0 vs app/models/bodega/order.rb in bodega-0.4.1
- old
+ new
@@ -42,21 +42,25 @@
raise ActiveRecord::Rollback
end
end
end
+ def new_shipping_rates?
+ @new_shipping_rates
+ end
+
def payment_method
return nil unless Bodega.config.payment_method
@payment_method ||= "Bodega::PaymentMethod::#{Bodega.config.payment_method.to_s.camelize}".constantize.new(self)
end
def products
order_products.map(&:product)
end
def ready?
- shipping_method.present? || shipping_rates.any?
+ shipping_method.nil? || shipping_rates.present?
end
def remove_product(item)
unless item.is_a?(Bodega::OrderProduct)
item = order_product(item)
@@ -134,9 +138,10 @@
self.identifier = self.class.count.succ.to_s(36)
end
def set_shipping_rates
self.shipping_rates = postal_code.present? ? shipping_method.rates : nil
+ @new_shipping_rates = true
end
def set_total
self.total = subtotal + tax + shipping
end