From f7b7bc8abe6455ec8da543eb64d98d5d711d0773 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Wed, 30 Jan 2019 17:45:50 +0100 Subject: [PATCH] DEV: move 'default_scope' to default sort on 'has_many' relation --- plugins/poll/app/models/poll.rb | 2 +- plugins/poll/app/models/poll_option.rb | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/plugins/poll/app/models/poll.rb b/plugins/poll/app/models/poll.rb index fd5422a620b..3c21f880cc3 100644 --- a/plugins/poll/app/models/poll.rb +++ b/plugins/poll/app/models/poll.rb @@ -4,7 +4,7 @@ class Poll < ActiveRecord::Base belongs_to :post - has_many :poll_options, dependent: :destroy + has_many :poll_options, -> { order(:id) }, dependent: :destroy has_many :poll_votes enum type: { diff --git a/plugins/poll/app/models/poll_option.rb b/plugins/poll/app/models/poll_option.rb index 96a8d9372b1..027c97710ba 100644 --- a/plugins/poll/app/models/poll_option.rb +++ b/plugins/poll/app/models/poll_option.rb @@ -1,8 +1,6 @@ class PollOption < ActiveRecord::Base belongs_to :poll has_many :poll_votes, dependent: :delete_all - - default_scope { order(:id) } end # == Schema Information