I have a model with many attributes, and you created a series of pages to collect all the relevant data. On the last page I want to show the user all the data collected.
I could create this page by manually typing all the labels and values ββfor each attribute, but I expect that such a tedious and repetitive task has already been solved by someone, in 3-4 lines of code.
At this point, I am only prototyping so that it does not look good.
Does anyone have any suggestions on how to quickly print all the attributes of a model on the screen?
I thought something like this:
If @my_data_model is an instance variable for which I want to print attributes, then:
<%= show_attributes @my_data_model %>
displays attribute values ββwith their labels.
Thanks pending.
source
share