Fantastic Models and Where to Find Them - acessoajustica/acessoajustica GitHub Wiki
If you don't know the reference, stop everything and watch it!
The Ability model is used by the CanCan Gem which is in charge of PERMISSIONS. The 'manage' permission is the highest one.
The Atendimento model is by far the most complex and has several interdependencies:
- Binds Cliente and Estagiario.
- Has an unique AtendimentoType, which is this class' specialization.
- At this moment, these specializations are not yet implemented.
- Check our Entity-Relationship Diagram (ERD).
- AtendimentoResultado is part of the business logic. It would be great if you implemented it.
- Especialidade might be better descripted as a tag associated to Atendimento in the context of this relationship, because each Atendimento belongs to Estagiarios and Estagiario has a Especialidade, so you can query the Atendimento binded to the Estagiarios which have this given Especialidade, so it's said that Atendimento belongs to Especialidade.
Also, the method canTakeMe?
describes Atendimentos which are not assigned
to an Estagiario.
The Cliente model is an specialization of Pessoa, which we still will get to here, it also has the following interdepencies:
- EstadoCivil is not yet implemented.
- MoradiaType and ProfissaoType are just fields in the Cliente form.
The Estagiario model is a specialization of user and each Estagiario can
be a Diretor, that's why there's the method is_diretor
. We may want to check
the ERD.