Skip to content

Polymorphic columns do not work #148

@wizardofosmium

Description

@wizardofosmium

For a model such as

class Icon

  include MotionModel::Model
  include MotionModel::ArrayModelAdapter
  
  columns(
    name: :string
  )
  
  belongs_to :record, polymorphic: true
  
end

The following raises a classify exception:

widget = Widget.create
gadget = Gadget.create
icon = Icon.create

icon.record
icon.record = widget
icon.record
icon.record = gadget

because belongs_to_relation assumes you can always classify the column, but the column specifically raises an exception when trying to classify a polymorphic column.

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