I am new to rails and I have a question on tables.
I have 2 tables.

Points with :id, :name, :x, :y

Polygons with :id, :name and an array of points (references to points
from the Points table). What matters is the order of points in the
polygon, which follows the order points are linked in the polygon. There
is a many to many relationship between Points and Polygons through a
Points_Polygons table (:point_id :polygon_id)
My question is what’s the best way to implement this ordering in Rails?
I thought of adding a :point_order field to the Points_Polygons table,
but this seems very inefficient in case of frequent insertion/deletion
of points in/from polygons, as each time I insert a point inside a
polygon I need to update the point_order field for the points folowing
the insertion point.
P.S. In the C implementation I have a linked list of Points, and a
Linked list of Polygons, where each Polygon stores its own list of
points in a form of a linked list of pointers to points from the Points
list.