Created
October 29, 2015 15:54
-
-
Save sowasred2012/873c1dfc7ab573f55dfe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Spree::Order.prepend(Kjus::Order) | |
Spree::Order.class_eval do | |
attr_accessor :use_shipping | |
before_validation :clone_shipping_address, if: :use_shipping? | |
def use_shipping? | |
@use_shipping == true || @use_shipping == 'true' || @use_shipping == '1' | |
end | |
def clone_billing_address | |
end | |
def clone_shipping_address | |
if ship_address and self.bill_address.nil? | |
self.bill_address = ship_address.clone | |
else | |
self.bill_address.attributes = ship_address.attributes.except('id', 'updated_at', 'created_at') | |
end | |
true | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
📦