Skip to content

Cannot store additional attribute on stops_tours table with HABTM #48

@ehayon

Description

@ehayon

Activerecord won't let us store additional attributes on the join table for a has_and_belongs_to_many relationship.

We'll need to change this to a has_many :through relationship for rails to acknowledge the position attribute.

With our current schema:

  create_table "stops_tours", id: false, force: true do |t|
    t.integer  "tour_id"
    t.integer  "stop_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer  "position"
  end

Rails has no idea that the position attribute even exists. Needs to be refactored into a has_many :through model...

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