Ruby on rails form for postgresql array

I did not find any example of how to make a dynamic form for a field that is a Postgresql array.

I want to populate it dynamically with Mustache.js. I have done this before, but with a string field using json string.

I am using ruby2.0, rails4.0 and postgresql9.1.

Many thanks.

+4
source share
1 answer

You can insert array values ​​into the form with:

<input type = 'textbox' name = 'model[array_column_name][:item_1, :item_2...]'> params['model']['array_column_name'] 

I am not familiar with mustache.js, but the above should give you an approximate idea of ​​how to implement a form with a PostgreSQL array.

+2
source

Source: https://habr.com/ru/post/1493251/


All Articles