I need a bit help with dynamically generating column-based table instead of row-based table.
Let’s say that I have a hospital and hospital has many patients.
Hospital no 1
| Day 1 | Day 2 | Day 3
Patient 1 | 36.6 | 36.4 | 36.5
Patient 2 | 37.0 | 37.1 | 36.6
Patient 3 | 37.1 | 36.4 | 36.7
Patient 4 | 36.6 | 36.6 | 36.6
Patient 5 | 36.7 | 37.1 | 36.4
Each day, each patient has his body temperature checked. I would like to get a tip/hint or example of help dynamically drawing such table – adding new data vertically, not horizontally. Hopefully you get what i mean.
Thank you, in advance 🙂
I’m assuming you meant something like this:
you have three models:
Than you can build a table in an erb view like this:
I’m assuming you have some column with a date in your Reading Model, I just called it
date_of_reading