I have a many-to-many relation between two entities. The join table has a field called position, which is supposed to be used for ordering.
class Film < Relation[:sql] associations do has_many :actors, through: :film_actors end end class Actor < Relation[:sql] ... end class FilmActor < Relation[:sql] schema do ... attribute :position, Types::Integer end dataset do order(:position) end end
Whenever I use
films.combine(:actors) I expect
actors to have an order specified by
FilmActor relation. However, it doesn’t work this way. Instead, it orders by
actors.id, even though it jons
I’ve tried modifying relation to
has_many :actors, through: :film_actors, order: :position, but it doesn’t work either.
However, Sequel::Model supports it just fine:
many_to_many :actors, join_table: :film_actors, order: :position
So here’s the question: how do I achieve the same using rom-rb with rom-sql?