Is a decorator, like Draper, a good place to store the controller and
routes associated with a given model?
I would like to be able to pass one or several model objects to a
generic
view, and have the view automatically generate links to the actions
associated with the objects. Like this:
I will answer myself: i think a decorator is not a good place to store
an
associated controller, a decorator should only know about model data and
HTML markup. I am still looking for a good solution.
On Monday, 8 October 2012 01:38:22 UTC-7, Alexey wrote:
I will answer myself: i think a decorator is not a good place to store an
associated controller, a decorator should only know about model data and
HTML markup. I am still looking for a good solution.
In your example, the controller path seems highly relevant to
generating
HTML markup…
On Monday, October 8, 2012 7:37:21 PM UTC+2, Matt J. wrote:
In your example, the controller path seems highly relevant to generating
HTML markup…
–Matt J.
Matt, i do not agree: if my application changes the host, or i decide to
change route names or controller names, the link urls will change, but
html
tags or model behavior will not. I think controller awareness should be
added on a different level, not in a decorator (single responsibility
principle).