Skip to content

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.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