DEV: move 'default_scope' to default sort on 'has_many' relation

This commit is contained in:
Régis Hanol 2019-01-30 17:45:50 +01:00
parent c02e81fe01
commit f7b7bc8abe
2 changed files with 1 additions and 3 deletions

View File

@ -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: {

View File

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