I am trying to create the following HTML table in Rails 7:
| Dec-20 | Dec-21 | |
|---|---|---|
| Item1 | 2 | 4 |
| Item2 | 3 | 5 |
The data is stored in a normalized way:
| date | item | value |
|---|---|---|
| Dec-20 | Item1 | 2 |
| Dec-21 | Item1 | 4 |
This seems to be a fairly straightforward use case but I have not found a good example or tool explaining how to do this, either in the controller or in HTML. These articles give a partial explanation: How to group events objects under a single shared date with group_by How do I group content according to date (Rails) Any guidance would be appreciated. Particularly if there is a tool, similar to Chartkick that automates this process. Thank you.