Save from params to JSONB datatype column using Postgres
|Added at||2016-11-16 17:11|
I'm kinda new working with JSONB datatype column and I'm having some trouble saving the data the way I'd like to my database in Ruby on Rails.
I'd like to save the data as follows:
So basically an Array that has 2 elements, first being a Hash, and second being an Array of n Hashes, not necessarily the same number between records.
I want to save like this because I want to be able to do something like:
The data comes from a Form and I'm saving it directly from Params, and it's saving as follows:
It saves exactly as the Params look like.
I'd like to get rid of the indexes, because I can't iterate through the inner Array to retrieve the data.
1) Is it possible to save the data the way I'd like?