Add compatibility for rails 4 and spree > 2