Created
June 14, 2009 20:49
-
-
Save jimmybaker/129809 to your computer and use it in GitHub Desktop.
This file contains 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
def set_default | |
if addressable.kind_of?(User) | |
if default_shipping? | |
addressable.addresses.default_shipping.without(self).each{|a| a.update_attribute(:default_shipping, false) } | |
else | |
default_shipping = true if addressable.addresses.default_shipping.empty? | |
end | |
if default_billing? | |
addressable.addresses.default_billing.without(self).each{|a| a.update_attribute(:default_billing, false) } | |
else | |
default_billing = true if addressable.addresses.default_shipping.empty? | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment