Skip to content

Calling jsonb column doesn’t return default values #175

@borisrorsvort

Description

@borisrorsvort

Given this configuration

  jsonb_accessor :voting_options, voting_options_type: [:string, { default: "single", store_key: :type }] 

With an empty db column i get an empty hash

irb(main):015:0> a.voting_options
=> {}
irb(main):016:0> a.voting_options_type
=> "single"
irb(main):017:0> a.voting_options["type"]
=> nil
irb(main):018:0>

I would be expecting to get the default values

{
    "type": "single"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions