Last active
October 9, 2018 01:00
-
-
Save aristotelesbr/1a52d4efad672894fb6e15244d8e5791 to your computer and use it in GitHub Desktop.
Last example
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
class AccountUser | |
prepend Account | |
def default_attributes | |
{ | |
cpf: '' | |
} | |
end | |
end | |
class AccountStore | |
prepend Account | |
def default_attributes | |
{ | |
cnpj: '' | |
} | |
end | |
end | |
# Note que agora Account fica antes de AccountUser na cadeia de ascendência. | |
AccountUser.ancestors | |
=> [Account, AccountUser, Object, Kernel, BasicObject] | |
AccountStore.new.default_attributes | |
=> {:cnpj=>"", :name=>"", :state=>"", :city=>""} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment