Ruby on Rails form with array of nested hashes

89 Views Asked by At

I'm trying to build a rails form to submit an array of nested hashes. In controller i want to get params in structure like:

[
  {
    id: 'section1',
    rows:
      [
        { id: '1', seats: '1-20' },
        { id: '2', seats: '1-25' }
      ]
  },
  {
    id: 'section2',
    rows:
      [
        { id: '1', seats: '1-50' },
        ...
      ]
  },
  ...
]

It's not a problem to dynamically add additional sections and rows fields with js, but i cant figure out how this form should look like to work properly.

0

There are 0 best solutions below