rails 5 has_many through order on through table
I was able to get it working using
class DoctorProfile
has_many :specialties, -> { order 'doctor_specialties.ordinal' }, through: :doctor_specialties
end
class DoctorSpecialty < ApplicationRecord
belongs_to :doctor_profile
belongs_to :specialty
default_scope { order('ordinal ASC') }
end