mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
DEV: move 'default_scope' to default sort on 'has_many' relation
This commit is contained in:
parent
c02e81fe01
commit
f7b7bc8abe
2 changed files with 1 additions and 3 deletions
|
@ -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: {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue