Skip to content

Instantly share code, notes, and snippets.

@aristotelesbr
Last active October 9, 2018 01:00
Show Gist options
  • Save aristotelesbr/1a52d4efad672894fb6e15244d8e5791 to your computer and use it in GitHub Desktop.
Save aristotelesbr/1a52d4efad672894fb6e15244d8e5791 to your computer and use it in GitHub Desktop.
Last example
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