app/models/piggybak/shipping_method.rb in piggybak-0.4.22 vs app/models/piggybak/shipping_method.rb in piggybak-0.4.23
- old
+ new
@@ -33,20 +33,22 @@
end
def self.lookup_methods(cart)
active_methods = ShippingMethod.find_all_by_active(true)
- active_methods.inject([]) do |arr, method|
+ methods = active_methods.inject([]) do |arr, method|
klass = method.klass.constantize
if klass.available?(method, cart)
rate = klass.rate(method, cart)
arr << {
:label => "#{method.description} $#{"%.2f" % rate}",
:id => method.id,
:rate => rate }
end
arr
end
+
+ methods.sort_by { |b| b[:rate] }
end
def admin_label
self.description
end
end