RP
Size: a a a
RP
RV
RV
RV
RV
RV
RV
RP
EB
EB
Notification.includes(rules: :transport).limit(10).map { |n| n.rules.last.transport_kind }
EB
Notification.includes(rules: :transport).limit(10).map { |n| n.rules.order(:rule_priority).last.transport_kind }
EB
EB
EB
EB
EB
Notification.includes(rules: :transport).references(:rules).limit(10).map { |n| n.rules.last.transport_kind }
.references
to the rescueEB
EB
RP
notifications = Notification.limit(10)мб как-то так
ActiveRecord::Associations::Preloader.new().preload(notifications, [{ rules: :transport }])
notifications.map { |n| n.rules.order(:rule_priority).last.transport_kind }