spree/spree — pull request #4103 by dkubb (2013-12-12 00:52:21+00:00)
Title: Fix available package shipping methods (for master)

(NOTE: This is related to #4102)

This branch fixes the package shipping methods to only return the shipping methods that are *common* to all the shipping categories. The current code returns *all* the shipping methods, even those that may not apply to a product.

Typically this isn't noticeable since `Spree::Stock::Splitter::ShippingCategory` is enabled by default, and splits up the package into separate packages grouped by the shipping category. However, when this is not used then the package can potentially return invalid shipping methods.

This also adds a unique constraint to the table used by `Spree::ShippingMethodCategory` that ensures the join record is only recorded once. The migration will also remove any duplicate records before applying the uniqueness constraint.