I have a user model with address field as jsonb column.
class User < ApplicationRecord
#name :string, age :integer, address :jsonb
include SchemaStructures
validates :address, allow_blank: true, json: { message: lambda { |errors|
errors
}, schema: JSON_SCHEMA_ADDRESS }
end
Now if I initialize the object it will show the jsonb attribute as nil
User.new()
{name: nil, age: nil, address: nil}
But is it possible to generate the address structure from existing json_schema. so it will show like a normal object but nested like below
{name: nil, age: nil, address: {'city': nil, postcode: nil}}
Thank you