0
I would like to add methods to my model through a Presenter, but some methods are shared among other presenters.
Ex: os métodos 'pode_ser_mostrado?', 'pode_ser_editado?', 'pode_ser_excluido?'
What is the best way, create a presenter base to be extended by others? , or create a mixin included by presenters?
Example:
class ModeloPresenter < BasePresenter
end
or
class ModeloPresenter
include 'base_presenter'
end
In case how to implement?
Example of how to use methods:
<%= link_to 'Mostrar', show_usuario(usuario.id) if UsuarioPresenter.pode_ser_mostrado? %>
<%= link_to 'Mostrar', show_cliente(cliente.id) if ClientePresenter.pode_ser_mostrado? %>
<%= link_to 'Mostrar', show_local(local.id) if LocalPresenter.pode_ser_mostrado? %>
I also accept if there are suggestions for better ways to implement the same.
Can better elaborate the answer, if it really solves the OP problem?
– Bruno Augusto
see if it’s better explained now
– user5020