You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way to wrap all attributes of a model with a decorator? Similar to the way forms are wrapped with errors on the invalid form field, is there a conditional way to wrap each attribute being decorated with a error?
For example, in my model I have a data_results of jsonb which contains a json list of which attributes have errors as well as their descriptions of what the error messages are. If the there is an error present, I want to wrap that attribute on the show page with the error if it is present in the data_results.
I thought that a helper would be good for this possibility, but I'm not sure if draper should be doing this instead.
The text was updated successfully, but these errors were encountered:
@cdesch why not decorate the jsonb type class returned by calling model. data_results.decorate? Another option would be to decorate the result of data_results from your model.
Is there a way to wrap all attributes of a model with a decorator? Similar to the way forms are wrapped with errors on the invalid form field, is there a conditional way to wrap each attribute being decorated with a error?
For example, in my model I have a
data_results
ofjsonb
which contains a json list of which attributes have errors as well as their descriptions of what the error messages are. If the there is an error present, I want to wrap that attribute on theshow
page with the error if it is present in thedata_results
.I thought that a helper would be good for this possibility, but I'm not sure if draper should be doing this instead.
The text was updated successfully, but these errors were encountered: