Open allthesignals opened 4 years ago
Hi @allthesignals thanks and sorry for late response.
If I got the point you want to get something like this:
I did it with the code:
ATTRIBUTE_TYPES = {
...
jsonb_field: Field::JSONB.with_options(transform: %i[symbolize_keys], advanced_view: {
user_defined_key_here: Field::JSONB.with_options(transform: %i[symbolize_keys], advanced_view: {
table: Field::String,
sources: Field::JSONB.with_options(transform: %i[symbolize_keys], advanced_view: {
name: Field::String,
version: Field::String,
minYear: Field::String,
maxYear: Field::String
})
})
})
}.freeze
Please update me if I didn't got your point correct. Thanks!
First of all, I love this gem — amazing that it just works perfectly.
Perhaps I'm misunderstanding the documentation, but is there a way to use advanced view but allow for custom key objects?
For example:
With advanced view, I find it can enforce an up-front structure of the JSON schema. Is this possible? For now, I can just use the jsoneditor, but I find your advanced view to be much simpler.
That said, this may be a sign that I need to use some other kinds of objects in Rails (read: models), but this is great for now.