Skip to content

Default [] on type: :array is returning the exact same 'default' object #113

@nathankot

Description

@nathankot

For example:

class FakeModel
  include MotionModel::Model
  include MotionModel::ArrayModelAdapter
  include MotionModel::Validatable

  columns test: { type: :array, default: [] }
end

@one = FakeModel.new
@two = FakeModel.new

@one.test.push(:one)

p @one.test.object_id == @two.test.object_id # => true
p @two.test.inspect # => "[:one]"

Not sure if desirable? Happy to look into this if not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions