A platform for community discussion. Free, open, simple.
DEV: move 'default_scope' to default sort on 'has_many' relation
Régis Hanolf7b7bc8abe64
diff --git a/plugins/poll/app/models/poll.rb b/plugins/poll/app/models/poll.rbindex fd5422a620b..3c21f880cc3 100644--- a/plugins/poll/app/models/poll.rb+++ b/plugins/poll/app/models/poll.rb@@ -4,7 +4,7 @@ class Poll < ActiveRecord::Basebelongs_to :post- has_many :poll_options, dependent: :destroy+ has_many :poll_options, -> { order(:id) }, dependent: :destroyhas_many :poll_votesenum type: {diff --git a/plugins/poll/app/models/poll_option.rb b/plugins/poll/app/models/poll_option.rbindex 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::Basebelongs_to :pollhas_many :poll_votes, dependent: :delete_all-- default_scope { order(:id) }end# == Schema Information